Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting a cable with wire indexes beyond the cable's wirecount triggers a deep exception #208

Open
hyphz opened this issue Dec 27, 2020 · 1 comment

Comments

@hyphz
Copy link

hyphz commented Dec 27, 2020

This should instead be detected as an error at load time.

@kvid
Copy link
Collaborator

kvid commented Feb 12, 2022

Thank you for reporting this unfortunate error handling, @hyphz. I'm really sorry for you not receiving any feed-back about this issue for more than a year. That is not intentional, but is probably because the contributors to this project are only able to spend their spare time working with this, and there might be long periods without anyone reading new issues. Then some issues might slip through without any answer when trying to catch up after a low-activity period.

This is easy to reproduce with e.g. this input using Ubuntu 18.04.4 LTS and WSL1 in Windows 10, Pyhon 3.7.5, and WireViz v0.2, v0.3.2, or the current v0.4-dev:

connectors:
  X1:
    pincount: 2
cables:
  W1:
    colors: [BK, RD]
connections:
  - - W1: 3
    - X1: 2

The result was IndexError: list index out of range from a complex expression in the create_graph function.

I also tested a bad connector pin index by only changing the connection part of the input to this:

connections:
  - - W1: 2
    - X1: 3

The result was Exception: X1:3 not found. from the connect function which is easier to understand, but could also be improved further by e.g. this instead: Exception: In connection 1, pin X1:3 not found

The same connect function should also test for an unknown wire index (called via_wire inside the function) at the end of the block with the leading comment # check via cable similar to what is done in the block # check from and to connectors just above. At this moment, this is found at lines 47-83 of Harness.py in the current dev branch, but this link might get invalid when the dev branch evolve with new commits in the future.

Error message improvements like this are also discussed in the related issue #207.

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

No branches or pull requests

2 participants