You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a basic error handler using rescue_from :all that logs exceptions, notifies Airbrake and returns a basic 500 response. Unfortunately this doesn't work as described in the documentation, and this isn't called for all exceptions.
We had an issue with a decorator not being found, and so the formatter (we are using Rabl) was throwing an exception. This was caught here, and thrown again:
This was caught in the error middleware and passed directly to error_response with no options for logging or changing it (other than by hacking around with error_formatter):
In the end I changed the error middleware to raise an exception for this exception (...) which isn't great, but it allows me to return consistent errors when something goes wrong. It would be great if rescue_from :all worked as described, and allowed you to rescue from all exceptions 😄
The text was updated successfully, but these errors were encountered:
It seems wrong to have the formatter middleware blindly rescue all exceptions. Looks like this was part of the fix for #309 - how about having the XML formatter raise a more specific error and catching just that?
I added a basic error handler using
rescue_from :all
that logs exceptions, notifies Airbrake and returns a basic 500 response. Unfortunately this doesn't work as described in the documentation, and this isn't called for all exceptions.We had an issue with a decorator not being found, and so the formatter (we are using Rabl) was throwing an exception. This was caught here, and thrown again:
lib/grape/middleware/formatter.rb
This was caught in the error middleware and passed directly to
error_response
with no options for logging or changing it (other than by hacking around witherror_formatter
):lib/grape/middleware/error.rb
In the end I changed the error middleware to raise an exception for this exception (...) which isn't great, but it allows me to return consistent errors when something goes wrong. It would be great if
rescue_from :all
worked as described, and allowed you to rescue from all exceptions 😄The text was updated successfully, but these errors were encountered: