summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNihad Abbasov <narkoz.2008@gmail.com>2012-06-29 03:52:20 -0700
committerNihad Abbasov <narkoz.2008@gmail.com>2012-06-29 03:52:20 -0700
commit1d2c98186014cedc01f04382d507a34a71008ab1 (patch)
treefa6c4e2b1cb05d38342dc48c42d30fd097a632b7 /lib
parent0d67f209fcbabed5831d90561350a8e094c150c4 (diff)
downloadgitlab-ce-1d2c98186014cedc01f04382d507a34a71008ab1.tar.gz
return errors in json format
Diffstat (limited to 'lib')
-rw-r--r--lib/api.rb1
-rw-r--r--lib/api/helpers.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/api.rb b/lib/api.rb
index 5cc78e52850..6882615244b 100644
--- a/lib/api.rb
+++ b/lib/api.rb
@@ -3,6 +3,7 @@ Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
module Gitlab
class API < Grape::API
format :json
+ error_format :json
helpers APIHelpers
mount Users
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index cd2e39bf3a7..424a17b283c 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -5,7 +5,7 @@ module Gitlab
end
def authenticate!
- error!('401 Unauthorized', 401) unless current_user
+ error!({'message' => '401 Unauthorized'}, 401) unless current_user
end
end
end