Skip to content

Reraise exceptions where applicable#845

Merged
ogenstad merged 1 commit intoinfrahub-developfrom
pog-B904
Feb 20, 2026
Merged

Reraise exceptions where applicable#845
ogenstad merged 1 commit intoinfrahub-developfrom
pog-B904

Conversation

@ogenstad
Copy link
Contributor

@ogenstad ogenstad commented Feb 20, 2026

Why

Remove exceptions to linting rules

What changed

Reraise exceptions where it might be relevant

Summary by CodeRabbit

  • Chores
    • Enhanced exception chaining throughout the SDK for improved error diagnostics and debugging visibility
    • Updated error handling in CLI commands and validation operations to provide consistent exception context management
    • Enforced stricter exception chaining standards in code quality checks

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

This pull request refactors exception handling across the infrahub_sdk package to standardize exception chaining practices. Changes add explicit exception context preservation using from exc in several modules, including client, spec/object, and template. Conversely, other modules suppress context using from None for Typer exit and abort flows. The Ruff configuration is updated by removing B904 from the ignore list to enforce the "raise from" style within except blocks. Total changes span nine files with 14 lines added and 14 lines removed, consistently addressing exception chaining patterns throughout the codebase.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is minimal and lacks key sections. It does not explain the problem being solved, the rationale for exception chaining, implementation details, testing approach, or potential impacts. Expand the description to include: (1) Why proper exception chaining matters, (2) Which files were modified and why, (3) How to verify the changes, and (4) Any backward compatibility or behavioral implications.
Docstring Coverage ⚠️ Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Reraise exceptions where applicable' directly aligns with the main changeset, which systematically adds proper exception chaining using 'from exc' syntax across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: df74df0
Status: ✅  Deploy successful!
Preview URL: https://01cf58f0.infrahub-sdk-python.pages.dev
Branch Preview URL: https://pog-b904.infrahub-sdk-python.pages.dev

View logs

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 61.53846% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/ctl/cli_commands.py 0.00% 1 Missing ⚠️
infrahub_sdk/ctl/config.py 0.00% 1 Missing ⚠️
infrahub_sdk/ctl/exporter.py 0.00% 1 Missing ⚠️
infrahub_sdk/ctl/importer.py 0.00% 1 Missing ⚠️
infrahub_sdk/spec/object.py 50.00% 1 Missing ⚠️
@@                Coverage Diff                @@
##           infrahub-develop     #845   +/-   ##
=================================================
  Coverage             80.59%   80.59%           
=================================================
  Files                   118      118           
  Lines                 10235    10235           
  Branches               1538     1538           
=================================================
  Hits                   8249     8249           
  Misses                 1456     1456           
  Partials                530      530           
Flag Coverage Δ
integration-tests 40.40% <15.38%> (ø)
python-3.10 51.81% <46.15%> (ø)
python-3.11 51.81% <46.15%> (ø)
python-3.12 51.79% <46.15%> (-0.02%) ⬇️
python-3.13 51.81% <46.15%> (+0.01%) ⬆️
python-3.14 53.50% <46.15%> (+0.01%) ⬆️
python-filler-3.12 23.97% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/client.py 72.88% <100.00%> (ø)
infrahub_sdk/ctl/validate.py 52.11% <100.00%> (ø)
infrahub_sdk/template/__init__.py 96.89% <100.00%> (ø)
infrahub_sdk/ctl/cli_commands.py 71.77% <0.00%> (ø)
infrahub_sdk/ctl/config.py 67.27% <0.00%> (ø)
infrahub_sdk/ctl/exporter.py 50.00% <0.00%> (ø)
infrahub_sdk/ctl/importer.py 57.14% <0.00%> (ø)
infrahub_sdk/spec/object.py 85.19% <50.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ogenstad ogenstad marked this pull request as ready for review February 20, 2026 08:42
@ogenstad ogenstad requested a review from a team as a code owner February 20, 2026 08:42
@ogenstad ogenstad merged commit 96c5051 into infrahub-develop Feb 20, 2026
21 checks passed
@ogenstad ogenstad deleted the pog-B904 branch February 20, 2026 09:14
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.

2 participants

Comments