Not found errors raised by id_for use more specific error classes when they exist#583
Open
eizengan wants to merge 1 commit intoslack-ruby:masterfrom
Open
Not found errors raised by id_for use more specific error classes when they exist#583eizengan wants to merge 1 commit intoslack-ruby:masterfrom
eizengan wants to merge 1 commit intoslack-ruby:masterfrom
Conversation
Danger ReportNo issues found. |
dee11c7 to
e613a61
Compare
id_for raises more specific errors when they existe613a61 to
96e3e69
Compare
96e3e69 to
1a8bd62
Compare
mformus
approved these changes
Feb 19, 2026
dblock
requested changes
Feb 20, 2026
Collaborator
dblock
left a comment
There was a problem hiding this comment.
LGTM, thank you! Let's add a section to UPGRADING and bump the version to 3.2.0 since it's not a minor change.
It looks backwards compatible since NotFound errors are also SlackError's? Check?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Presently the
id_formethod always raises aSlackError. This means that when calling e.g.users_infoone must handle bothUserNotFoundandSlackError-with-a-message-equal-"user_not_found" to actually cover ones bases.Solution
This uses the existing error type deduction mechanism to raise a more specific error when one exists. At the time of writing this will work for all consumers of
id_forPotential issues
The specific errors are subclasses of
SlackError, and therefore will still behave as expected in existingrescues,is_a?calls, etc. Any class equality checks failing to account for inheritance, however, will break.