Skip to content

Commit 60a9d89

Browse files
committed
Add analysis_exceptiont
1 parent 7f621c8 commit 60a9d89

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/util/exception_utils.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,28 @@ incorrect_goto_program_exceptiont::incorrect_goto_program_exceptiont(
6060
{
6161
}
6262

63+
std::string incorrect_goto_program_exceptiont::what() const
64+
{
65+
return message + " (at: " + source_location.as_string() + ")";
66+
}
67+
6368
unsupported_operation_exceptiont::unsupported_operation_exceptiont(
6469
std::string message)
6570
: message(std::move(message))
6671
{
6772
}
6873

69-
std::string incorrect_goto_program_exceptiont::what() const
74+
std::string unsupported_operation_exceptiont::what() const
7075
{
71-
return message + " (at: " + source_location.as_string() + ")";
76+
return message;
7277
}
7378

74-
std::string unsupported_operation_exceptiont::what() const
79+
analysis_exceptiont::analysis_exceptiont(std::string reason)
80+
: reason(std::move(reason))
7581
{
76-
return message;
82+
}
83+
84+
std::string analysis_exceptiont::what() const
85+
{
86+
return reason;
7787
}

src/util/exception_utils.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,17 @@ class unsupported_operation_exceptiont : public cprover_exception_baset
107107
std::string message;
108108
};
109109

110+
/// Thrown when an unexpected error occurs during the analysis (e.g., when the
111+
/// SAT solver returns an error)
112+
class analysis_exceptiont : public cprover_exception_baset
113+
{
114+
public:
115+
explicit analysis_exceptiont(std::string reason);
116+
std::string what() const override;
117+
118+
private:
119+
/// The reason this exception was generated.
120+
std::string reason;
121+
};
122+
110123
#endif // CPROVER_UTIL_EXCEPTION_UTILS_H

0 commit comments

Comments
 (0)