Skip to content

Commit 087bbbb

Browse files
committed
Add analysis_exceptiont
1 parent 5e0a2fe commit 087bbbb

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

src/util/exception_utils.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ std::string invalid_user_input_exceptiont::what() const noexcept
1818
res += correct_input + "\n";
1919
return res;
2020
}
21+
22+
std::string analysis_exceptiont::what() const noexcept
23+
{
24+
std::string res;
25+
res += "Analysis Error\n";
26+
res += "Reason: " + reason + "\n";
27+
return res;
28+
}

src/util/exception_utils.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,17 @@ class invalid_user_input_exceptiont
3333
std::string what() const noexcept;
3434
};
3535

36+
class analysis_exceptiont
37+
{
38+
/// The reason this exception was generated.
39+
std::string reason;
40+
41+
public:
42+
analysis_exceptiont(std::string reason) : reason(reason)
43+
{
44+
}
45+
46+
std::string what() const noexcept;
47+
};
48+
3649
#endif // CPROVER_UTIL_EXCEPTION_UTILS_H

src/util/parse_options.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ int parse_options_baset::main()
7676
std::cerr << e.what() << "\n";
7777
return CPROVER_EXIT_USAGE_ERROR;
7878
}
79+
catch(analysis_exceptiont &e)
80+
{
81+
std::cerr << e.what() << "\n";
82+
return CPROVER_EXIT_EXCEPTION;
83+
}
84+
7985
return CPROVER_EXIT_SUCCESS;
8086
}
8187

0 commit comments

Comments
 (0)