summaryrefslogtreecommitdiff
path: root/lib/api.rb
diff options
context:
space:
mode:
authorFelix Gilcher <felix.gilcher@asquera.de>2013-01-29 18:20:59 +0100
committerFelix Gilcher <felix.gilcher@asquera.de>2013-01-29 18:20:59 +0100
commit2a669fc89997376af1e76bf3ed574d948009c5b2 (patch)
tree471817435035888a4680a51cdbd5dab315467a3f /lib/api.rb
parent9fdbdc662a01ac0845638c1012aa0625de6158be (diff)
downloadgitlab-ce-2a669fc89997376af1e76bf3ed574d948009c5b2.tar.gz
rescue all errors and return the proper format
This rescues all errors and returns a proper JSON response. Fixes #2833.
Diffstat (limited to 'lib/api.rb')
-rw-r--r--lib/api.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/api.rb b/lib/api.rb
index f58b82ff98e..3dd827158db 100644
--- a/lib/api.rb
+++ b/lib/api.rb
@@ -8,6 +8,10 @@ module Gitlab
rack_response({'message' => '404 Not found'}.to_json, 404)
end
+ rescue_from :all do
+ rack_response({'message' => '500 Internal Server Error'}, 500)
+ end
+
format :json
error_format :json
helpers APIHelpers