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

Exceptions for Error handling #112

Open
jacobmerson opened this issue Jul 1, 2022 · 1 comment
Open

Exceptions for Error handling #112

jacobmerson opened this issue Jul 1, 2022 · 1 comment

Comments

@jacobmerson
Copy link
Collaborator

In some ways the code we write isn't too sensitive to this since error handling typically means just crash if you did something dumb.

Since the APIs are much cleaner if we use function returns not for error codes, I would suggest that we make use of exceptions.

@cwsmith do you have strong feelings one way or another on this?

@cwsmith
Copy link
Contributor

cwsmith commented Jul 1, 2022

Yeah, I don't think I've been involved with any package that 'tried' to do something knowing it may not work and attempt to recover from that failure. Along those lines, I don't have any significant experience with error handling (beyond asserts etc.) so I'm pretty open to any option that is relatively simple to work with.

Do you have a small example of the exception based failure code? I've seen libraries that suggest placing try/catch blocks at the top level if the user wants to print meaningful error messages. Is that the idea here?

The xSDK folks have a 'recommended' policy, R3, regarding error handling here that we can consider:

https://figshare.com/articles/journal_contribution/xSDK_Community_Package_Policies/4495136

I like this idea:

For example, all routines may, by default, return an error code with the option of changing it to
generate an abort on the error (for running in the debugger).

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