Root the exception hierarchy in pyTooling's ExceptionBase - #178
Root the exception hierarchy in pyTooling's ExceptionBase#178vhdl-s-claude-bot[bot] wants to merge 1 commit into
Conversation
'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>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
🟢 Coverage 100.00% diff coverage · +0.00% coverage variation
Metric Results Coverage variation ✅ +0.00% coverage variation Diff coverage ✅ 100.00% diff coverage 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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Changes
VHDLModelExceptionderives frompyTooling.Exceptions.ExceptionBaseinstead of the builtinException.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 ExceptionBaseclause. Thesibling packages that already do it this way are
pyEDAA.CLITool,pyEDAA.OSVVM,pyEDAA.OutputFilterandpyEDAA.ToolSetup.Breaking Changes
ex.argsis now empty on every exception in this package.ExceptionBase.__init__does not forward toException.__init__; it keeps the text inself.messageand renders it through__str__. Sostr(ex),f-strings and logging are unaffected, but code reading
ex.args[0]has to readstr(ex)instead.Checked before making the change: nothing in the package or its tests reads
.args, and all 12 derivedexceptions 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
HasNotesandNotes, so attached notes can be read without touching__notes__directly - which only exists once a note has been attached.Related Issues and Pull-Requests
Exception;pyVHDLModel turned out to be a fourth.