From 2a669fc89997376af1e76bf3ed574d948009c5b2 Mon Sep 17 00:00:00 2001 From: Felix Gilcher Date: Tue, 29 Jan 2013 18:20:59 +0100 Subject: [PATCH] rescue all errors and return the proper format This rescues all errors and returns a proper JSON response. Fixes #2833. --- lib/api.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/api.rb b/lib/api.rb index f58b82ff9..3dd827158 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 -- 2.11.0