Commit 2a669fc89997376af1e76bf3ed574d948009c5b2

Authored by Felix Gilcher
1 parent 9fdbdc66

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 8 rack_response({'message' => '404 Not found'}.to_json, 404)
9 9 end
10 10  
  11 + rescue_from :all do
  12 + rack_response({'message' => '500 Internal Server Error'}, 500)
  13 + end
  14 +
11 15 format :json
12 16 error_format :json
13 17 helpers APIHelpers
... ...