-
-
Notifications
You must be signed in to change notification settings - Fork 138
Description
Description
When a request wants json (Accept header === 'application/json' or something), request validation errors should be a 424 json-response with the errors as the body.
Also when an exception occurs in the "json" context, it would be preferable to not get the error view, but a json response with the exception.
new Response(
body: [
'message' => $failure->getMessage(),
'code' => $failure->getCode(),
'file' => $failure->getFile(),
'line' => $failure->getLine(),
'trace' => $failure->getTrace(),
]),(a problem details response for all of these scenarios would be cool, but I guess that might be out-of-scope).
Right now you get a redirect or a view, which isn't that nice for api's.
Benefits
We can handle errors in apis better 👍