Skip to content

fix: resolve basedpyright type errors for sqlstate access#946

Merged
maxachis merged 1 commit intodevfrom
fix/basedpyright-sqlstate-type-error
Feb 10, 2026
Merged

fix: resolve basedpyright type errors for sqlstate access#946
maxachis merged 1 commit intodevfrom
fix/basedpyright-sqlstate-type-error

Conversation

@maxachis
Copy link
Copy Markdown
Contributor

@maxachis maxachis commented Feb 10, 2026

Summary

  • Fix 2 basedpyright errors in PostDataSourceQuery where e.orig.sqlstate was accessed on a BaseException-typed object
  • Use getattr(e.orig, "sqlstate", None) to safely access the psycopg3-specific attribute
  • Add "Pre-Commit Checks" section to CLAUDE.md documenting that basedpyright --level error should be run before committing

Test plan

  • uv run basedpyright --level error passes with 0 errors
  • CI checks pass

🤖 Generated with Claude Code

Use getattr to safely access sqlstate on IntegrityError.orig, which is
typed as BaseException but is a psycopg3 exception at runtime. Also add
pre-commit checks section to CLAUDE.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maxachis maxachis merged commit 9852c11 into dev Feb 10, 2026
5 checks passed
@maxachis maxachis deleted the fix/basedpyright-sqlstate-type-error branch February 10, 2026 23:34
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.

1 participant