rescue all errors and return the proper format
This rescues all errors and returns a proper JSON response. Fixes #2833.
This commit is contained in:
parent
9fdbdc662a
commit
2a669fc899
1 changed files with 4 additions and 0 deletions
|
@ -8,6 +8,10 @@ module Gitlab
|
||||||
rack_response({'message' => '404 Not found'}.to_json, 404)
|
rack_response({'message' => '404 Not found'}.to_json, 404)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rescue_from :all do
|
||||||
|
rack_response({'message' => '500 Internal Server Error'}, 500)
|
||||||
|
end
|
||||||
|
|
||||||
format :json
|
format :json
|
||||||
error_format :json
|
error_format :json
|
||||||
helpers APIHelpers
|
helpers APIHelpers
|
||||||
|
|
Loading…
Add table
Reference in a new issue