Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upChain exceptions where appropriate #15986
Comments
|
Hi, could I attempt to fix this issue. I've read through the contribution guide |
|
Sure @JanukanS, thanks. We don't usually assign issues. So you can search for these type of calls and simply open a PR with suggested changes linking this issue. |
|
Hi @seberg |
This solution is related to the issue #15986. I also made a change to the newer string formatting. Uses NameError, which prints nicer, and is actually the more correct error type. Co-authored-by: Eric Wieser <[email protected]> Co-authored-by: Ross Barnowski <[email protected]>
This solution is related to the issue numpy#15986. I also made a change to the newer string formatting. Uses NameError, which prints nicer, and is actually the more correct error type. Co-authored-by: Eric Wieser <[email protected]> Co-authored-by: Ross Barnowski <[email protected]>
This solution is related to the issue numpy#15986. I also made a change to the newer string formatting. Uses NameError, which prints nicer, and is actually the more correct error type. Co-authored-by: Eric Wieser <[email protected]> Co-authored-by: Ross Barnowski <[email protected]>
|
Can I work on this issue? It is my first issue and I want to give it a try! |
this solution is related to the following issue #15986 Co-authored-by: Ross Barnowski <[email protected]>
|
@ayao451 please feel free. A good place to start might be by checking the PRs linked in this issue: exception chaining has been added in quite a few places, and a few other instances have been identified as better off unchanged (e.g. nested exceptions in the test suite). |
|
A lot of these instances have been fixed (thanks to all the contributors for this!) It would be nice to have a "definition of done" for this issue if anyone wants to do a little forensics to see what's already been tackled, what's been reviewed and determined better left as-is, and what still remains to be done. |


Picking up from #15731, there are many places in numpy where we do something like:
It would produce a marginally clearer error if we could change these to use traceback chaining. Our two options are either:
from e.from None:An example of such a change would be this line of this otherwise-discarded patch.
For now, I would recommend we only apply this to cases where the exception is thrown unconditionally, as other cases can be more nuanced.