Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve error handling #118
I've taken care of only enabling whoops in debug mode. I also built error handlers for the frontend and the API. The frontend error pages are rather plain - I'll let you work your design magic on them, @tobscure. Maybe you're also more creative than me in making them unique and fun.
One thing I'm not sure about right now is the following: for some errors like validation errors etc., we probably do not want to show Whoops, even when in debug mode, right? (I guess it depends on how AJAX errors are handled exactly in the frontend.) Any good idea how we could take care of those cases?
Currently if the front-end doesn't receive JSON, it basically crashes the JS app. I will wrap the JSON parsing code with a try/catch so that it doesn't, and instead show a little red alert in the bottom left. So I think in debug mode any abnormal exception can trigger whoops and then you can use the browser inspector to see the error details.
But you're completely right about not wanting some errors (validation in particular) to be handled with whoops. We actually already have code in JsonApiAction@handle to catch some of those and output JSON-API spec errors. I think this could all be moved into a new error handler middleware. And if debug is not enabled, this needs to catch all exceptions and output a generic JSON-API spec error too.
Edit: the latter of which I see you've done! Nice!
referenced this issue
Aug 12, 2015
What needs to be done: