Skip to content

include both type and message when inheriting field-level errors #95

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

Merged
merged 1 commit into from
May 14, 2025

Conversation

aaronrosenthal
Copy link
Contributor

Include both type and message when inheriting field-level errors.

This can be useful in situations where we might want to query the errors without having to consider the full message. For example:

begin
  ::SignupOp.submit!(email: nil)
rescue Subroutine::Failure => e
  if e.record.errors.added?(:email, :blank)
    # some special handling of the error here...
  end
end

@mnelson mnelson merged commit 1f90562 into main May 14, 2025
3 checks passed
@mnelson mnelson deleted the inherit-error-type branch May 14, 2025 13:43
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.

2 participants