File tree Expand file tree Collapse file tree 4 files changed +56
-5
lines changed
Expand file tree Collapse file tree 4 files changed +56
-5
lines changed Original file line number Diff line number Diff line change 1010
1111#include < util/arith_tools.h>
1212#include < util/replace_expr.h>
13+ #include < util/invariant_utils.h>
1314
1415bvt bv_cbmct::convert_waitfor (const exprt &expr)
1516{
Original file line number Diff line number Diff line change @@ -206,8 +206,7 @@ cbmc_solverst::solvert* cbmc_solverst::get_smt1(smt1_dect::solvert solver)
206206 {
207207 if (solver==smt1_dect::solvert::GENERIC)
208208 {
209- error () << " please use --outfile" << eom;
210- throw 0 ;
209+ throw user_exceptiont (" please use --outfile" );
211210 }
212211
213212 smt1_dect *smt1_dec=
@@ -245,8 +244,7 @@ cbmc_solverst::solvert* cbmc_solverst::get_smt1(smt1_dect::solvert solver)
245244
246245 if (!out)
247246 {
248- error () << " failed to open " << filename << eom;
249- throw 0 ;
247+ IO_EXCEPTION_WITH_FILENAME (" failed to open" , filename);
250248 }
251249
252250 smt1_convt *smt1_conv=
Original file line number Diff line number Diff line change 2222
2323#include < util/json.h>
2424#include < util/json_expr.h>
25+ #include < util/invariant_utils.h>
2526
2627void bmct::show_vcc_plain (std::ostream &out)
2728{
@@ -150,7 +151,7 @@ void bmct::show_vcc()
150151 {
151152 of.open (filename);
152153 if (!of)
153- throw " failed to open file " +filename;
154+ throw system_exceptiont ( " failed to open file " +filename) ;
154155 }
155156
156157 std::ostream &out=have_file?of:std::cout;
Original file line number Diff line number Diff line change 1+ /* ******************************************************************\
2+
3+ Module: Exception helper utilities
4+
5+ Author: Peter Schrammel, [email protected] 6+
7+ \*******************************************************************/
8+
9+ #ifndef CPROVER_UTIL_EXCEPTION_UTILS_H
10+ #define CPROVER_UTIL_EXCEPTION_UTILS_H
11+
12+ #include " invariant.h"
13+
14+ // / A logic error to be used for OS-related errors (I/O etc)
15+ class system_exceptiont : public std ::logic_error
16+ {
17+ public:
18+ system_exceptiont (
19+ const std::string &_reason):
20+ std::logic_error (_reason)
21+ {
22+ }
23+ };
24+
25+ // / A logic error to be used for user interface errors
26+ class ui_exceptiont : public std ::logic_error
27+ {
28+ public:
29+ ui_exceptiont (
30+ const std::string &_reason):
31+ std::logic_error (_reason)
32+ {
33+ }
34+ };
35+
36+ // / A user interface exception with source locations
37+ class input_src_exceptiont : public ui_exceptiont
38+ {
39+ public:
40+ input_src_exceptiont (
41+ const source_locationt &_source_location,
42+ const std::string &_reason):
43+ ui_exceptiont (_reason),
44+ source_location (_source_location)
45+ {
46+ }
47+
48+ source_locationt source_location;
49+ };
50+
51+ #endif // CPROVER_UTIL_EXCEPTION_UTILS_H
You can’t perform that action at this time.
0 commit comments