diff options
author | jubianchi <contact@jubianchi.fr> | 2014-08-18 20:09:09 +0200 |
---|---|---|
committer | jubianchi <contact@jubianchi.fr> | 2014-09-16 01:25:24 +0200 |
commit | 998cd3cb63d56a0058c8e519d7c20e3d6e540899 (patch) | |
tree | 38b9319858451f8bbebc7670e5505a7f1e6665e1 /lib/api/merge_requests.rb | |
parent | 892371bc22813abe855f563bf4f0ee355fe067ab (diff) | |
download | gitlab-ce-998cd3cb63d56a0058c8e519d7c20e3d6e540899.tar.gz |
Improve error reporting on users API
* users (#6878, #3526, #4209): Validation error messages are now exposed through 400 responses, 409 response are sent in case of duplicate email or username
* MRs (#5335): 409 responses are sent in case of duplicate merge request (source/target branches), 422 responses are sent when submiting MR fo/from unrelated forks
* issues
* labels
* projects
Diffstat (limited to 'lib/api/merge_requests.rb')
-rw-r--r-- | lib/api/merge_requests.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 8726379bf3c..40111014032 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -10,8 +10,13 @@ module API error!(errors[:project_access], 422) elsif errors[:branch_conflict].any? error!(errors[:branch_conflict], 422) + elsif errors[:validate_fork].any? + error!(errors[:validate_fork], 422) + elsif errors[:validate_branches].any? + conflict!(errors[:validate_branches]) end - not_found! + + render_api_error!(errors, 400) end end @@ -214,7 +219,7 @@ module API if note.save present note, with: Entities::MRNote else - not_found! + render_validation_error!(note) end end end |