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

Clean up of error code/messages from XSPEC module. #84

Merged
merged 1 commit into from
Sep 10, 2015

Conversation

DougBurke
Copy link
Contributor

Release Note

Clarified error messages in Xspec extension. Also, changed the class of the exception from RuntimeError to more appropriate exception types, in particular LookupError, ValueError, KeyError.

This is a backwards-incompatible change, in that code that caught the RuntimeError will not catch the new error.

Description

Change RuntimeError to more appropriate values, as well as some
re-wording of error messages (although it is likely that some won't
ever fire). This includes and extends a change included in PR #63 in
_sherpa_init_xspec_library().

Change RuntimeError to more appropriate values, as well as some
re-wording of error messages (although it is likely that some won't
ever fire). This includes and extends a change included in PR #63 in
_sherpa_init_xspec_library().
@olaurino
Copy link
Member

This change is not backward compatible. If users had code that caught RuntimeException that code would not capture the new exceptions (I checked and it does not look like e.g. ValueError extends RuntimeError). As in a similar case in a different PR, I am not against this change as long as we are OK with the consequences and we properly stress them in the Release Notes.

@DougBurke
Copy link
Contributor Author

I view our use of RuntimeError in Sherpa as a crutch, so would like to replace them with more-semantically meaningful values (hence the PR). We have never guaranteed the exception raised by these routines, so whilst I agree documenting them is good, I don't think it's a significant breaking change.

One thing to think about is whether this module should be raising errors derived from the sherpa.utils.err.SherpaErr class rather than default Python ones.

@DougBurke DougBurke merged commit c6017e7 into master Sep 10, 2015
DougBurke added a commit that referenced this pull request Sep 10, 2015
@DougBurke DougBurke deleted the feature/xspec-cleanup-error-handling branch September 10, 2015 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants