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

Improve error handling #122

Open
Krzmbrzl opened this issue Jul 27, 2023 · 0 comments
Open

Improve error handling #122

Krzmbrzl opened this issue Jul 27, 2023 · 0 comments

Comments

@Krzmbrzl
Copy link
Collaborator

Krzmbrzl commented Jul 27, 2023

In a couple of places, SeQuant simply calls abort if it has entered part of the code which has either not been implemented or which indicates that the function has been used in a wrong way (e.g. doesn't make sense).

However, this is sub-optimal for users as abort will just do that: abort the program with no indication whatsoever about what (and where something) has gone wrong.
Thus, they'll have to load SeQuant into a debugger, find where abort is called and then check the source code to either try and figure out themselves why abort is called or hope to find a comment there explaining just that.

It would be much more user-friendly, if at least an error message was printed in such cases.

Additionally, it seems to me that there are two different handling strategies that are used in SeQuant for this kind of situation:

  1. Calling abort
  2. Throwing an exception

The latter has the big advantage of giving the end-user a hint as to what has gone wrong. However, exceptions can be caught and ignored and there are situations where one might not want that. But on the other hand, I think this would then be the end-user intentionally shooting in their own foot, so I wouldn't worry about that.

Therefore, I would like to refactor the code to replace abort either with a throw statement or at least add a line that prints an error message before that (probably in form of a macro, similar to assert).

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

1 participant