diff options
author | Sebastian Ziebell <sebastian.ziebell@asquera.de> | 2013-02-13 18:48:52 +0400 |
---|---|---|
committer | Sebastian Ziebell <sebastian.ziebell@asquera.de> | 2013-02-13 18:48:52 +0400 |
commit | 6fc3263e15b71830e6f1b2a66891da5f4c055137 (patch) | |
tree | f46179ab65e682b260ab3ce09a83ce1d3988b153 /lib/api/notes.rb | |
parent | 54ab9bb6df3a2cd9f9384aebae07e0b18acee10b (diff) |
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/notes.rb')
-rw-r--r-- | lib/api/notes.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 47dead9dfae..56de6e090e5 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -44,7 +44,7 @@ module Gitlab present @note, with: Entities::Note else # :note is exposed as :body, but :note is set on error - error!(@note.errors[:note], 400) if @note.errors[:note].any? + bad_request!(:note) if @note.errors[:note].any? not_found! end end |