Laravel 11 Route Model Binding: Why the Detailed Error Message Regardless of Environment? #52575
Unanswered
ozdemirrulass
asked this question in
Q&A
Replies: 3 comments 15 replies
-
Did you set debug to false as well? |
Beta Was this translation helpful? Give feedback.
1 reply
-
About the exception which is transformed to a |
Beta Was this translation helpful? Give feedback.
1 reply
-
You can override response when ever this exception is thrown,
|
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In Laravel 11, there's something I find confusing and would like clarification on. When using route model binding, a ModelNotFoundException is translated into a NotFoundHttpException.
In addition to that regardless of whether the debug mode is active or not, or if the environment is set to production or local. The error message directly returns the model namespace and identifier, like:
No query results for model [App\Models\<MODEL_NAME>] <MODEL_IDENTIFIER>
I used a custom ApiException class and implemented custom behavior in app.php to solve it, but this still seems a bit weird.
Can anyone shed light on why this is the case?
Beta Was this translation helpful? Give feedback.
All reactions