Conversation
- Connector with style 'simple' and multiple pins now reports connector name, actual pin count, and a suggested fix - Pin label resolving to an out-of-bounds index raises a clear message instead of an IndexError - Referencing an undefined cable raises a descriptive error instead of a KeyError - Component generation and harness.connect() calls are wrapped with context identifying the connection set number and component names Closes wireviz#505 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #505
Summary
When a WireViz YAML file contains a mistake, errors currently surface as opaque Python tracebacks with no indication of which connector, cable, or connection set caused the failure. This PR improves error reporting in three areas:
wv_dataclasses.py: Thestyle: simplepin count check now includes the connector's designator, the detected pin count, and a suggested fix rather than a bare message.wv_harness.py: Two new explicit guards — one for a pin label resolving to an out-of-bounds index (previously an unhandledIndexError), and one for a connection referencing an undefined cable (previously aKeyError).wireviz.py: Component generation andharness.connect()calls are wrapped to add context to any exception, identifying the connection set number and component names involved (e.g."Error in connection set 3 (X1 → W1 → X2): ...").These changes are purely additive to error handling and do not affect any output.
Test plan
style: simpleand multiple pins — error now reads:Connector 'X1' has style 'simple', which only supports one pin, but 3 pin(s) were specified. Either remove 'style: simple' or reduce to a single pin.pinlabels/pinslength — error now reads:X1: pin label 'C' (index 2) has no corresponding pin number — connector has 2 pin(s) but 3 pinlabel(s).UNDEFINED_CABLE is an unknown template/designator/arrow.(caught at component generation, wrapped with connection set context)Error in connection set 1 (X1 → NONEXISTENT → X1): ...