Skip to content
Browse files


  • Loading branch information...
1 parent 15803ae commit 93732a3daf2476e597e6700b2912a334be00875d Michael Bleigh committed
Showing with 4 additions and 7 deletions.
  1. +4 −7 README.markdown
11 README.markdown
@@ -75,15 +75,12 @@ You can also return JSON formatted objects explicitly by raising error! and pass
## Exception Handling
-By default Grape does not catch all unexpected exceptions. This means that the web server will handle the error and render the default error page as a result. It is possible to trap all exceptions by setting `rescue_all_errors true` instead. You may change the error format to JSON by using `error_format :json` and set the default error status to 200 with `default_error_status 200`. You may also include the complete backtrace of the exception with `rescue_with_backtrace true` either as text (for the :txt format) or as a :backtrace field in the json (for the :json format).
+Grape can be told to rescue certain (or all) exceptions in your
+application and instead display them in text or json form. To do this,
+you simply use the `rescue_from` method inside your API declaration:
class Twitter::API < Grape::API
- rescue_all_errors true
- rescue_with_backtrace true
- error_format :json
- default_error_status 200
- # api methods
+ rescue_from ArgumentError, NotImplementedError # :all for all errors
## Note on Patches/Pull Requests

0 comments on commit 93732a3

Please sign in to comment.
Something went wrong with that request. Please try again.