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.
This commit is contained in:
Sebastian Ziebell 2013-02-13 15:48:52 +01:00
parent 54ab9bb6df
commit 6fc3263e15
6 changed files with 28 additions and 17 deletions

View file

@ -13,7 +13,7 @@ module Gitlab
#
def handle_milestone_errors(milestone_errors)
if milestone_errors[:title].any?
error!(milestone_errors[:title], 400)
bad_request!(:title)
end
end
end