summaryrefslogtreecommitdiff
path: root/lib/api/api.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-07-29 12:14:36 +0200
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-07-29 20:35:38 +0200
commit1b72256fa14e65256d78347f81b289d43c44e991 (patch)
tree923e3597ad8b0199d77f57331bd44e7b81251bdd /lib/api/api.rb
parent76e9b68439510af5c783a81b93944f1c8d96d150 (diff)
downloadgitlab-ce-1b72256fa14e65256d78347f81b289d43c44e991.tar.gz
Use Grape DSL for environment endpoints
Also a couple of minor edits for this branch are included
Diffstat (limited to 'lib/api/api.rb')
-rw-r--r--lib/api/api.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb
index 9c960d74495..bd16806892b 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -7,6 +7,10 @@ module API
rack_response({ 'message' => '404 Not found' }.to_json, 404)
end
+ rescue_from Grape::Exceptions::ValidationErrors do |e|
+ error!({ messages: e.full_messages }, 400)
+ end
+
rescue_from :all do |exception|
# lifted from https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb#L60
# why is this not wrapped in something reusable?