-
Notifications
You must be signed in to change notification settings - Fork 273
RFC: handling of fatal errors #1280
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
RFC: handling of fatal errors #1280
Conversation
IMHO neither |
@hannes-steffenhagen-diffblue Agreed that the exceptions in b2c6da2 should be subclassing |
I think a large class of errors may be caught by invariants already, but maybe it could be a good idea to have an exception type that signals things gone wrong during analysis, like |
@@ -35,4 +36,23 @@ class parse_options_baset | |||
bool parse_result; | |||
}; | |||
|
|||
class parse_optionst: public parse_options_baset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could remove parse_optionst
and include the new code directly in parse_options_baset
.
{ | ||
message.error() << e.what() << messaget::eom; | ||
} | ||
return 6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all these exceptions are fatal and shouldn't be caught anywhere else, I wonder whether we should include the exit code in the exceptions. Then the different catch clauses would return via return e.exit_code()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that could make some sense.
I think we don't need to derive the new exception classes from any of the standard exceptions. It doesn't seem to have a benefit in this use case and only increases the chance that they get caught inadvertently. We could create a new base class |
Has been done. |
Ultimate goal:
We've already got invariant_failedt for programming errors. I added two more (naming debatable):
I put the top-level catch into a class derived from parse_options_baset so that the various tools do not need to duplicate the exception handling code.
This PR is for illustration of the concepts.