-
Notifications
You must be signed in to change notification settings - Fork 277
Add additional exception classes and introduce base exception #2996
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
Add additional exception classes and introduce base exception #2996
Conversation
1a86de4
to
d44183a
Compare
This adds a number of new exception classes that are meant to be used to replace unstructured throws in other parts of the code. The exception types have been selected according to what we already determined we are going to need. Further, this has a slight fix in the format for invalid_user_input_exceptiont (it did previously not add a separator between the reason and the suggestion on how to fix the error). This also adds a cprover_exception_baset which is mean to avoid unnecessary overhead when adding new exception types - without it, all driver programs would have to updated to explicitly catch the new exception type whenever we introduce one. Also removes some dead code parse_options_baset (there was a final return that cannot be reached because all ancestor statements are returns).
d44183a
to
fb1be5d
Compare
@@ -71,12 +71,16 @@ int parse_options_baset::main() | |||
|
|||
return doit(); | |||
} | |||
catch(invalid_user_input_exceptiont &e) | |||
catch(const invalid_user_input_exceptiont &e) | |||
{ | |||
std::cerr << e.what() << "\n"; | |||
return CPROVER_EXIT_USAGE_ERROR; |
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'm not sure whether or not we can merge this into the below case because this returns a different error code than the other exceptions.
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.
Looks reasonable to be left as is, as it is in line with the previous code, which had a semantic distinction for the case when a user was passing a wrong argument (which afaik, is also important for automated tools or scripts using cbmc).
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.
LGTM
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.
LGTM
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.
Passed Diffblue compatibility checks (cbmc commit: fb1be5d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85327320
This is part of the error handling cleanup work we are doing at the moment. It unifies the several exception types we introduced during that work into a single commit and addresses some requests for changes common to all of them at the same time.
This adds a number of new exception classes that are meant to be used to replace
unstructured throws in other parts of the code. The exception types have been
selected according to what we already determined we are going to need.
Further, this has a slight fix in the format for invalid_user_input_exceptiont
(it did previously not add a separator between the reason and the suggestion on
how to fix the error).
This also adds a cprover_exception_baset which is mean to avoid unnecessary
overhead when adding new exception types - without it, all driver programs would
have to updated to explicitly catch the new exception type whenever we introduce
one.
Also removes some dead code parse_options_baset (there was a final return that
cannot be reached because all ancestor statements are returns).