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 |
| bool parse_result; | ||
| }; | ||
|
|
||
| class parse_optionst: public parse_options_baset |
There was a problem hiding this comment.
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.
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.
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.