API: status code 403 returned if new project would exceed limit

When the project limit is reached the user is not allowed to create new ones.
Instead of error code 404 the status code 403 (Forbidden) is returned with error
message via API.
This commit is contained in:
Sebastian Ziebell 2013-02-14 15:51:56 +01:00
parent 6fc3263e15
commit 6df02adc7a
3 changed files with 17 additions and 1 deletions

View file

@ -58,6 +58,9 @@ module Gitlab
if @project.saved?
present @project, with: Entities::Project
else
if @project.errors[:limit_reached].present?
error!(@project.errors[:limit_reached], 403)
end
not_found!
end
end