Skip to content

Initialize error data using constructors directly - #2165

Merged
dblock merged 1 commit into
ruby-grape:masterfrom
bjfish:bjfish/initialize-custom-error-data
Mar 6, 2021
Merged

dblock merged 1 commit into
ruby-grape:masterfrom
bjfish:bjfish/initialize-custom-error-data

Conversation

@bjfish

@bjfish bjfish commented Mar 5, 2021 •

Copy link
Copy Markdown
Contributor

This avoids using the Kernel#raise string message parameter to initialize custom data for errors in favor of initializing with the data directly as described here:
#2164 (comment)

This is also consistent with other usages like:

raise Grape::Exceptions::InvalidVersionerOption.new(strategy)

raise Grape::Exceptions::MissingOption.new(key) unless options.key?(key)

@grape-bot

Copy link
Copy Markdown
2 Warnings
⚠️ There're library changes, but not tests. That's OK as long as you're refactoring existing code.
⚠️ Unless you're refactoring existing code or improving documentation, please update CHANGELOG.md.

Here's an example of a CHANGELOG.md entry:

* [#2165](https://github.com/ruby-grape/grape/pull/2165): Initialize error data using constructors directly - [@bjfish](https://github.com/bjfish).

Generated by 🚫 Danger

@dblock

dblock commented Mar 6, 2021

Copy link
Copy Markdown
Member

Anything changes for users that may be relying on this that deserves a CHANGELOG/README/UPGRADING?

@eregon eregon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look good to me. It should work exactly the same or better, no user visible changes (except maybe slightly faster to build those exceptions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants