Skip to content

Commit

Permalink
Align the signature of Grape::DSL#error! method
Browse files Browse the repository at this point in the history
  • Loading branch information
numbata committed Jul 3, 2024
1 parent 9a551b1 commit 61cd18a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/grape/dsl/inside_route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,14 @@ def configuration
# end user with the specified message.
#
# @param message [String] The message to display.
# @param status [Integer] the HTTP Status Code. Defaults to default_error_status, 500 if not set.
# @param status [Integer] The HTTP Status Code. Defaults to default_error_status, 500 if not set.
# @param additional_headers [Hash] Addtional headers for the response.
def error!(message, status = nil, additional_headers = nil)
# @param backtrace [Array<String>] The backtrace of the exception caused an error
# @param backtrace [Exception] The exception causes an error
def error!(message, status = nil, additional_headers = nil, backtrace = nil, original_exception = nil)
status = self.status(status || namespace_inheritable(:default_error_status))
headers = additional_headers.present? ? header.merge(additional_headers) : header
throw :error, message: message, status: status, headers: headers
throw :error, message: message, status: status, headers: headers, backtrace: backtrace, original_exception: original_exception
end

# Creates a Rack response based on the provided message, status, and headers.
Expand Down

0 comments on commit 61cd18a

Please sign in to comment.