Use match statement in get_error_message#2136
Merged
Merged
Conversation
Replace if-isinstance chains with structural pattern matching for exception-specific branches in get_error_message. Closes #2133 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
if isinstance(exc, ...)chains with amatch exc:statement inget_error_messagefor cleaner structural pattern matching.case _fallback preserves the existingKeyErrorbehavior for unknown exception types.Closes #2133
Note
Low Risk
Mostly a refactor of CLI error-message selection plus dev dependency lockfile bumps; runtime behavior should be unchanged aside from any Python version compatibility expectations for
match.Overview
Refactors
get_error_messageinsrc/vws_cli/_error_handling.pyfrom anisinstancechain to amatch/casestatement while preserving the same message outputs and the existing fallback behavior for unhandled exception types.Updates
uv.lockto bump dev tooling dependencies (pyreflyto0.61.0,tyto0.0.30).Reviewed by Cursor Bugbot for commit 9347605. Bugbot is set up for automated code reviews on this repo. Configure here.