Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error_response deprecation ? #2253

Open
ericproulx opened this issue Feb 28, 2022 · 1 comment
Open

error_response deprecation ? #2253

ericproulx opened this issue Feb 28, 2022 · 1 comment
Labels

Comments

@ericproulx
Copy link
Contributor

There's a todo for deprecation (it's been a while) but there's no warn DEPRECATION. Since it's use internally, adding a warning will pop every single time.

I think we should not use it internally and add a proper warning DEPRECATION. What do you think ?

# TODO: This method is deprecated. Refactor out.
def error_response(error = {})
status = error[:status] || options[:default_status]
message = error[:message] || options[:default_message]
headers = { Grape::Http::Headers::CONTENT_TYPE => content_type }
headers.merge!(error[:headers]) if error[:headers].is_a?(Hash)
backtrace = error[:backtrace] || error[:original_exception]&.backtrace || []
original_exception = error.is_a?(Exception) ? error : error[:original_exception] || nil
rack_response(format_message(message, backtrace, original_exception), status, headers)
end

@dblock
Copy link
Member

dblock commented Mar 1, 2022

Makes sense, please.

@dblock dblock added the chore label Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants