Skip to content

Use match statement in get_error_message#2136

Merged
adamtheturtle merged 1 commit into
mainfrom
adamtheturtle/match-get-error-msg
Apr 15, 2026
Merged

Use match statement in get_error_message#2136
adamtheturtle merged 1 commit into
mainfrom
adamtheturtle/match-get-error-msg

Conversation

@adamtheturtle

@adamtheturtle adamtheturtle commented Apr 15, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace if isinstance(exc, ...) chains with a match exc: statement in get_error_message for cleaner structural pattern matching.
  • The case _ fallback preserves the existing KeyError behavior for unknown exception types.
  • No behavior change — all return values are identical.

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_message in src/vws_cli/_error_handling.py from an isinstance chain to a match/case statement while preserving the same message outputs and the existing fallback behavior for unhandled exception types.

Updates uv.lock to bump dev tooling dependencies (pyrefly to 0.61.0, ty to 0.0.30).

Reviewed by Cursor Bugbot for commit 9347605. Bugbot is set up for automated code reviews on this repo. Configure here.

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>
@adamtheturtle adamtheturtle merged commit 77d436a into main Apr 15, 2026
16 checks passed
@adamtheturtle adamtheturtle deleted the adamtheturtle/match-get-error-msg branch April 15, 2026 05:01
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.

Use match in get_error_message for exception-specific branches

1 participant