summaryrefslogtreecommitdiff
path: root/app/services/base_service.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-14 03:06:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-14 03:06:25 +0000
commit29c01c6c91558358c37ba45b03f240632bfb918d (patch)
treec6475afaf98ce740e8ba5fe227e7bd4a95b692cd /app/services/base_service.rb
parenteed996ac33a60d5fd8315a62fec8beaa8e907e69 (diff)
downloadgitlab-ce-29c01c6c91558358c37ba45b03f240632bfb918d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/base_service.rb')
-rw-r--r--app/services/base_service.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/services/base_service.rb b/app/services/base_service.rb
index c39edd5c114..bc0b968f516 100644
--- a/app/services/base_service.rb
+++ b/app/services/base_service.rb
@@ -50,16 +50,24 @@ class BaseService
private
- def error(message, http_status = nil)
+ # Return a Hash with an `error` status
+ #
+ # message - Error message to include in the Hash
+ # http_status - Optional HTTP status code override (default: nil)
+ # pass_back - Additional attributes to be included in the resulting Hash
+ def error(message, http_status = nil, pass_back: {})
result = {
message: message,
status: :error
- }
+ }.reverse_merge(pass_back)
result[:http_status] = http_status if http_status
result
end
+ # Return a Hash with a `success` status
+ #
+ # pass_back - Additional attributes to be included in the resulting Hash
def success(pass_back = {})
pass_back[:status] = :success
pass_back