cprover
Loading...
Searching...
No Matches
exception_utils.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Exception helper utilities
4
5Author: Fotis Koutoulakis, fotis.koutoulakis@diffblue.com
6
7\*******************************************************************/
8
9#ifndef CPROVER_UTIL_EXCEPTION_UTILS_H
10#define CPROVER_UTIL_EXCEPTION_UTILS_H
11
12#include <string>
13
14#include "invariant.h"
15#include "source_location.h"
16
25{
26public:
30 virtual std::string what() const = 0;
31 virtual ~cprover_exception_baset() = default;
32};
33
38{
40 std::string reason;
43 std::string option;
45 std::string correct_input;
46
47public:
49 std::string reason,
50 std::string option,
51 std::string correct_input = "");
52
53 std::string what() const override;
54};
55
61{
62public:
63 explicit system_exceptiont(std::string message);
64 std::string what() const override;
65
66private:
67 std::string message;
68};
69
73{
74public:
75 explicit deserialization_exceptiont(std::string message);
76
77 std::string what() const override;
78
79private:
80 std::string message;
81};
82
90{
91public:
92 explicit incorrect_goto_program_exceptiont(std::string message);
93
94 template <typename Diagnostic, typename... Diagnostics>
96 std::string message,
97 Diagnostic &&diagnostic,
98 Diagnostics &&... diagnostics);
99
100 template <typename... Diagnostics>
102 std::string message,
104 Diagnostics &&... diagnostics);
105
106 std::string what() const override;
107
108private:
109 std::string message;
111
112 std::string diagnostics;
113};
114
115template <typename Diagnostic, typename... Diagnostics>
117 std::string message,
118 Diagnostic &&diagnostic,
119 Diagnostics &&... diagnostics)
120 : message(std::move(message)),
121 source_location(),
122 diagnostics(detail::assemble_diagnostics(
123 std::forward<Diagnostic>(diagnostic),
124 std::forward<Diagnostics>(diagnostics)...))
125{
126}
127
128template <typename... Diagnostics>
130 std::string message,
131 source_locationt source_location,
132 Diagnostics &&... diagnostics)
133 : message(std::move(message)),
134 source_location(std::move(source_location)),
135 diagnostics(
136 detail::assemble_diagnostics(std::forward<Diagnostics>(diagnostics)...))
137{
138}
139
144{
145public:
146 explicit unsupported_operation_exceptiont(std::string message);
147 std::string what() const override;
148
149private:
151 std::string message;
152};
153
157{
158public:
159 explicit analysis_exceptiont(std::string reason);
160 std::string what() const override;
161
162private:
164 std::string reason;
165};
166
171{
172public:
173 explicit invalid_source_file_exceptiont(std::string reason);
174 std::string what() const override;
175
176private:
177 std::string reason;
178};
179
180#endif // CPROVER_UTIL_EXCEPTION_UTILS_H
Thrown when an unexpected error occurs during the analysis (e.g., when the SAT solver returns an erro...
std::string what() const override
A human readable description of what went wrong.
std::string reason
The reason this exception was generated.
Base class for exceptions thrown in the cprover project.
virtual std::string what() const =0
A human readable description of what went wrong.
virtual ~cprover_exception_baset()=default
Thrown when failing to deserialize a value from some low level format, like JSON or raw bytes.
std::string what() const override
A human readable description of what went wrong.
Thrown when a goto program that's being processed is in an invalid format, for example passing the wr...
incorrect_goto_program_exceptiont(std::string message)
std::string what() const override
A human readable description of what went wrong.
Thrown when users pass incorrect command line arguments, for example passing no files to analysis or ...
std::string what() const override
A human readable description of what went wrong.
std::string reason
The reason this exception was generated.
std::string correct_input
In case we have samples of correct input to the option.
std::string option
The full command line option (not the argument) that got erroneous input.
Thrown when we can't handle something in an input source file.
std::string what() const override
A human readable description of what went wrong.
Thrown when some external system fails unexpectedly.
std::string what() const override
A human readable description of what went wrong.
std::string message
Thrown when we encounter an instruction, parameters to an instruction etc.
std::string what() const override
A human readable description of what went wrong.
std::string message
The unsupported operation causing this fault to occur.
STL namespace.