File tree 4 files changed +56
-5
lines changed
4 files changed +56
-5
lines changed Original file line number Diff line number Diff line change 10
10
11
11
#include < util/arith_tools.h>
12
12
#include < util/replace_expr.h>
13
+ #include < util/invariant_utils.h>
13
14
14
15
bvt bv_cbmct::convert_waitfor (const exprt &expr)
15
16
{
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)
206
206
{
207
207
if (solver==smt1_dect::solvert::GENERIC)
208
208
{
209
- error () << " please use --outfile" << eom;
210
- throw 0 ;
209
+ throw user_exceptiont (" please use --outfile" );
211
210
}
212
211
213
212
smt1_dect *smt1_dec=
@@ -245,8 +244,7 @@ cbmc_solverst::solvert* cbmc_solverst::get_smt1(smt1_dect::solvert solver)
245
244
246
245
if (!out)
247
246
{
248
- error () << " failed to open " << filename << eom;
249
- throw 0 ;
247
+ IO_EXCEPTION_WITH_FILENAME (" failed to open" , filename);
250
248
}
251
249
252
250
smt1_convt *smt1_conv=
Original file line number Diff line number Diff line change 22
22
23
23
#include < util/json.h>
24
24
#include < util/json_expr.h>
25
+ #include < util/invariant_utils.h>
25
26
26
27
void bmct::show_vcc_plain (std::ostream &out)
27
28
{
@@ -150,7 +151,7 @@ void bmct::show_vcc()
150
151
{
151
152
of.open (filename);
152
153
if (!of)
153
- throw " failed to open file " +filename;
154
+ throw system_exceptiont ( " failed to open file " +filename) ;
154
155
}
155
156
156
157
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