summaryrefslogtreecommitdiff
path: root/lib/api/merge_requests.rb
diff options
context:
space:
mode:
authorSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-13 15:48:52 +0100
committerSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-13 15:48:52 +0100
commit6fc3263e15b71830e6f1b2a66891da5f4c055137 (patch)
treef46179ab65e682b260ab3ce09a83ce1d3988b153 /lib/api/merge_requests.rb
parent54ab9bb6df3a2cd9f9384aebae07e0b18acee10b (diff)
downloadgitlab-ce-6fc3263e15b71830e6f1b2a66891da5f4c055137.tar.gz
API: extracted helper method to provide 400 bad request error with description
Extracted a method for 400 error (Bad request) and adjusted code accordingly. The name of the missing attribute is used to show which one was missing from the request. It is used to give an appropriate message in the json response.
Diffstat (limited to 'lib/api/merge_requests.rb')
-rw-r--r--lib/api/merge_requests.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index a0ca3026acb..0c18ece3824 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -13,9 +13,9 @@ module Gitlab
#
def handle_merge_request_error(merge_request_errors)
if merge_request_errors[:target_branch].any?
- error!(merge_request_errors[:target_branch], 400)
+ bad_request!(:target_branch)
elsif merge_request_errors[:source_branch].any?
- error!(merge_request_errors[:source_branch], 400)
+ bad_request!(:source_branch)
elsif merge_request_errors[:base].any?
error!(merge_request_errors[:base], 422)
end
@@ -129,7 +129,7 @@ module Gitlab
present note, with: Entities::MRNote
else
if note.errors[:note].any?
- error!(note.errors[:note], 400)
+ bad_request!(:note)
end
not_found!
end