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

Initialize error data using constructors directly #2165

Merged

Conversation

bjfish
Copy link
Contributor

@bjfish bjfish commented Mar 5, 2021

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

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
Copy link
Member

dblock commented Mar 6, 2021

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

Copy link
Contributor

@eregon eregon left a comment

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.

None yet

4 participants