Commit 17d67e633482c128446e388b49548c543db0b3ed
1 parent
8125ba61
Exists in
master
• rescue StandardError when the unknown goes wrong
Showing
1 changed file
with
14 additions
and
0 deletions
Show diff stats
app/controllers/concerns/scim_rails/exception_handler.rb
... | ... | @@ -68,6 +68,20 @@ module ScimRails |
68 | 68 | ) |
69 | 69 | end |
70 | 70 | end |
71 | + | |
72 | + ## StandardError must be ordered last or it will catch all exceptions | |
73 | + if Rails.env.production? | |
74 | + rescue_from StandardError do |e| | |
75 | + json_response( | |
76 | + { | |
77 | + schemas: ["urn:ietf:params:scim:api:messages:2.0:Error"], | |
78 | + detail: e.message, | |
79 | + status: "500" | |
80 | + }, | |
81 | + :internal_server_error | |
82 | + ) | |
83 | + end | |
84 | + end | |
71 | 85 | end |
72 | 86 | end |
73 | 87 | end | ... | ... |