Should ResourceNotFound be mapped to a 404?
#756
Closed
indykoning
started this conversation in
Feature Requests
Replies: 1 comment 1 reply
-
|
Out of curiosity, when are you running into the 500 error? Which route? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When a
runway/src/Exceptions/ResourceNotFound.php
Line 5 in 27defcb
gets triggered it will cause a 500 error at the moment. Is this the intended behavior?
Laravel transforms their ModelNotFoundExceptions into NotFoundHttpException which makes more sense to me.
https://github.com/laravel/framework/blob/c9adca09a451f315aea8b92008021b12589d5206/src/Illuminate/Foundation/Exceptions/Handler.php#L668
We could emulate this behaviour using the render method: https://laravel.com/docs/12.x/errors#renderable-exceptions
Or alternatively https://github.com/laravel/framework/blob/c9adca09a451f315aea8b92008021b12589d5206/src/Illuminate/Foundation/Exceptions/Handler.php#L256 might work as well.
This way a 404 is rendered in case of a missing resource instead of a 500 error.
Beta Was this translation helpful? Give feedback.
All reactions