Skip to content

Populate .NET's InnerException from exc.__cause__ when available #893

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

Open
lostmsu opened this issue Jun 24, 2019 · 1 comment
Open

Populate .NET's InnerException from exc.__cause__ when available #893

lostmsu opened this issue Jun 24, 2019 · 1 comment

Comments

@lostmsu
Copy link
Member

lostmsu commented Jun 24, 2019

PythonException objects should provide InnerException property when __cause__ is set in the original Python exception. This is a reverse-direction of feature #223

lostmsu added a commit to losttech/pythonnet that referenced this issue Jun 24, 2019
This change only affects some exception handling, but not all of it. Instead, parameterless PythonException constructor is made Obsolete. PythonException.FromPyErr() should be called instead.

FromPyErr will check __cause__, and, if present, parse it into InnerException property.

This change will cause a slowdown, as I found no way to read __cause__ on demand, because InnerException is not virtual.

This addresses pythonnet#893
lostmsu added a commit to losttech/pythonnet that referenced this issue Jun 25, 2019
PythonException.FromPyErr was not properly handling __cause__ of None
@Cronan
Copy link
Contributor

Cronan commented Jun 26, 2019

Makes sense

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