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

Add custom message parameter to #not_nil! #12797

Merged
merged 1 commit into from
Dec 15, 2022

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Nov 28, 2022

This patch adds a parameter to #not_nil! that allows customizing the error message when raising NilAssertionError.

One use case for customized messages is in the getter! and property! macros (the implementation is simplified with the customization parameter, but not included in this PR).
Another use case is detailed in #4776 (comment)

@straight-shoota straight-shoota self-assigned this Dec 8, 2022
Copy link
Member

@beta-ziliani beta-ziliani left a comment

Choose a reason for hiding this comment

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

🚀

@beta-ziliani beta-ziliani added this to the 1.7.0 milestone Dec 14, 2022
@straight-shoota straight-shoota merged commit 649f061 into master Dec 15, 2022
@straight-shoota straight-shoota deleted the feature/not_nil-message branch December 15, 2022 12:25
carlhoerberg pushed a commit to carlhoerberg/crystal that referenced this pull request Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants