Skip to content

Root the exception hierarchy in pyTooling's ExceptionBase - #178

Open
vhdl-s-claude-bot[bot] wants to merge 1 commit into
devfrom
claude/exception-base
Open

Root the exception hierarchy in pyTooling's ExceptionBase#178
vhdl-s-claude-bot[bot] wants to merge 1 commit into
devfrom
claude/exception-base

Conversation

@vhdl-s-claude-bot

Copy link
Copy Markdown

Changes

  • VHDLModelException derives from pyTooling.Exceptions.ExceptionBase instead of the builtin Exception.

    It is the root of this package's whole hierarchy - 12 exception classes - so until now nothing pyVHDLModel raises
    could be caught alongside the rest of a pyTooling-based stack with a single except ExceptionBase clause. The
    sibling packages that already do it this way are pyEDAA.CLITool, pyEDAA.OSVVM, pyEDAA.OutputFilter and
    pyEDAA.ToolSetup.

Breaking Changes

  • ⚠️ ex.args is now empty on every exception in this package. ExceptionBase.__init__ does not forward to
    Exception.__init__; it keeps the text in self.message and renders it through __str__. So str(ex),
    f-strings and logging are unaffected, but code reading ex.args[0] has to read str(ex) instead.

    Checked before making the change: nothing in the package or its tests reads .args, and all 12 derived
    exceptions reach super().__init__(message) with a single message - the multi-argument constructors
    (EntityExistsInLibraryError(entity, library)) build their message first and pass one string on.

  • In exchange, every exception gains HasNotes and Notes, so attached notes can be read without touching
    __notes__ directly - which only exists once a note has been attached.


Related Issues and Pull-Requests

'VHDLModelException' derived from the builtin 'Exception', so nothing
this package raises could be caught alongside the rest of a
pyTooling-based stack with one 'except ExceptionBase' clause. The
sibling packages that do it this way are pyEDAA.CLITool, OSVVM,
OutputFilter and ToolSetup.

The 12 derived exceptions all reach 'super().__init__(message)' with a
single message, and nothing in the package reads '.args', so the one
observable change is that 'ex.args' is now empty while 'str(ex)' keeps
working - 'ExceptionBase' stores the text and renders it via
'__str__'. It also brings 'HasNotes' and 'Notes'.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
@vhdl-s-claude-bot
vhdl-s-claude-bot Bot requested a review from Paebbels as a code owner August 21, 2026 21:56
@codacy-production

codacy-production Bot commented Aug 21, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.00% coverage variation

Metric Results
Coverage variation +0.00% coverage variation
Diff coverage 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (98ac5cd) Report Missing Report Missing Report Missing
Head commit (58fcc1f) 5220 (+1) 4642 (+1) 88.93% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#178) 2 2 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.14%. Comparing base (98ac5cd) to head (58fcc1f).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #178   +/-   ##
=======================================
  Coverage   87.14%   87.14%           
=======================================
  Files          24       24           
  Lines        5219     5220    +1     
  Branches      446      446           
=======================================
+ Hits         4548     4549    +1     
  Misses        578      578           
  Partials       93       93           
Flag Coverage Δ
unittests 87.14% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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