Skip to content

fix: narrow broad exception handling and enforce zip strictness - #22

Merged
codeasier merged 1 commit into
mainfrom
fix/narrow-exceptions
Apr 17, 2026
Merged

codeasier merged 1 commit into
mainfrom
fix/narrow-exceptions

Conversation

@codeasier

Copy link
Copy Markdown
Owner

📝 Description

Two related exception handling improvements:

  1. Narrow broad except Exception in cli.py use command — now catches specific DatabaseNotFoundError/SchemaVersionError with a clearer fallback message for unexpected failures
  2. Enforce zip(strict=True) in executor.py — catches column count mismatches early rather than silently producing wrong results

🔗 Related Issue

Fixes #16

🧪 Testing

  • Tests pass — no test behavior changed
  • Manual testing completed

✅ Checklist

  • Code follows project guidelines
  • No new warnings introduced
  • Changes tested locally

- Split broad except Exception in use command into specific
  DatabaseNotFoundError/SchemaVersionError + fallback with clearer message
- Change zip(columns, row, strict=False) to strict=True to catch
  column count mismatches early rather than silently producing wrong results

Closes #16

@codeasier codeasier left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

/lgtm

@codeasier
codeasier merged commit 5de3e87 into main Apr 17, 2026
5 checks passed
@codeasier
codeasier deleted the fix/narrow-exceptions branch April 17, 2026 13:30
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.

[BUG] 代码质量改进:过于宽泛的异常捕获和 zip strict=False

1 participant