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
Copy file name to clipboardExpand all lines: README.md
+30-3Lines changed: 30 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,20 +40,47 @@ From this point you'll have default html errors being serialized. JsonapiErrorsH
40
40
41
41
If you rise any of errors above in any place of your application, client gets the nicely formatted error message instead of 500
42
42
43
+
### Handling unexpected errors
44
+
45
+
If you want to handle all the errors in your API application to deliver nicely formatted JSON response about 500 instead crashing the server, add this when your application loads:
46
+
47
+
```ruby
48
+
require'jsonapi_errors_handler'
49
+
50
+
JsonapiErrorsHandler.configure do |config|
51
+
config.handle_unexpected =true
52
+
end
53
+
```
54
+
43
55
### Custom errors mapping
44
56
45
57
If you want your custom errors being handled by default, just add them to the mapper
0 commit comments