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

Fixed reraising of plotting exceptions #1158

Merged
merged 1 commit into from
Feb 27, 2017
Merged

Fixed reraising of plotting exceptions #1158

merged 1 commit into from
Feb 27, 2017

Conversation

philippjfr
Copy link
Member

This has been plaguing me for a long time. In python2 I always get these exceptions when there's an issue with the options. I think this is due to the nested try/excepts. Reraising an exception in this way differs slightly between py2 and py3 hence extra conditional.

TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

@philippjfr
Copy link
Member Author

Appears there's some persistent py2 failure now, will have to look into it.

@jlstevens
Copy link
Contributor

I've always found reports of this error very mysterious - not only does the error message make no sense (all our classes derive from object, we don't have any old style classes!) but I've never been able to reproduce it myself.

Using raise to re-raise an exception is official, documented Python behavior so I don't know why it would cause issues. I am happy to merge a fix as long as the right traceback is displayed - ideally, it would just be a re-raised exception but that is what it is doing now and for some reason it has issues!

@philippjfr
Copy link
Member Author

Using raise to re-raise an exception is official, documented Python behavior so I don't know why it would cause issues

It is if you're simply reraising, if you have another try/except in the same block you have to do what I did in the PR.

@jlstevens
Copy link
Contributor

I am happy to merge if you have checked the correct traceback is shown (which was a previous issue with this code that was fixed) and once the tests pass.

@jbednar
Copy link
Member

jbednar commented Feb 27, 2017

This problem has also bedeviled me, and I'm very glad there is a fix!

@philippjfr
Copy link
Member Author

I've tested it on py2 and py3. The only thing that would be nice is to maybe shorten the traceback a bit, or rather show just the exception message for ValueErrors coming from param validation.

@jlstevens
Copy link
Contributor

The only thing that would be nice is to maybe shorten the traceback a bit, or rather show just the exception message for ValueErrors coming from param validation.

That can be implemented in a separate PR.Merging.

@jlstevens jlstevens merged commit 26feb9f into master Feb 27, 2017
@philippjfr philippjfr deleted the reraise branch February 27, 2017 23:29
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

Successfully merging this pull request may close these issues.

3 participants