Commit 2a669fc89997376af1e76bf3ed574d948009c5b2
1 parent
9fdbdc66
Exists in
master
and in
4 other branches
rescue all errors and return the proper format
This rescues all errors and returns a proper JSON response. Fixes #2833.
Showing
1 changed file
with
4 additions
and
0 deletions
Show diff stats
lib/api.rb
@@ -8,6 +8,10 @@ module Gitlab | @@ -8,6 +8,10 @@ module Gitlab | ||
8 | rack_response({'message' => '404 Not found'}.to_json, 404) | 8 | rack_response({'message' => '404 Not found'}.to_json, 404) |
9 | end | 9 | end |
10 | 10 | ||
11 | + rescue_from :all do | ||
12 | + rack_response({'message' => '500 Internal Server Error'}, 500) | ||
13 | + end | ||
14 | + | ||
11 | format :json | 15 | format :json |
12 | error_format :json | 16 | error_format :json |
13 | helpers APIHelpers | 17 | helpers APIHelpers |