cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
exception_utils.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Exception helper utilities
4
5
Author: Fotis Koutoulakis, fotis.koutoulakis@diffblue.com
6
7
\*******************************************************************/
8
9
#include "
exception_utils.h
"
10
#include <utility>
11
12
std::string
cprover_exception_baset::what
()
const
13
{
14
return
reason
;
15
}
16
17
std::string
invalid_command_line_argument_exceptiont::what
()
const
18
{
19
std::string res;
20
res +=
"Invalid User Input"
;
21
res +=
"\nOption: "
+
option
;
22
res +=
"\nReason: "
+
reason
;
23
// Print an optional correct usage message assuming correct input parameters have been passed
24
if
(!
correct_input
.empty())
25
{
26
res +=
"\nSuggestion: "
+
correct_input
;
27
}
28
return
res;
29
}
30
31
invalid_command_line_argument_exceptiont::
32
invalid_command_line_argument_exceptiont
(
33
std::string
reason
,
34
std::string
option
,
35
std::string
correct_input
)
36
:
cprover_exception_baset
(
std
::move(
reason
)),
37
option
(
std
::move(
option
)),
38
correct_input
(
std
::move(
correct_input
))
39
{
40
}
41
42
system_exceptiont::system_exceptiont
(std::string message)
43
:
cprover_exception_baset
(
std
::move(message))
44
{
45
}
46
47
deserialization_exceptiont::deserialization_exceptiont
(std::string message)
48
:
cprover_exception_baset
(
std
::move(message))
49
{
50
}
51
52
incorrect_goto_program_exceptiont::incorrect_goto_program_exceptiont
(
53
std::string message)
54
:
cprover_exception_baset
(
std
::move(message)),
55
source_location
(
source_locationt
::nil())
56
{
57
}
58
59
std::string
incorrect_goto_program_exceptiont::what
()
const
60
{
61
std::string ret(
reason
);
62
63
if
(!
source_location
.is_nil())
64
ret +=
" (at: "
+
source_location
.as_string() +
")"
;
65
66
if
(!
diagnostics
.empty())
67
ret +=
"\n"
+
diagnostics
;
68
69
return
ret;
70
}
71
72
unsupported_operation_exceptiont::unsupported_operation_exceptiont
(
73
std::string message)
74
:
cprover_exception_baset
(
std
::move(message))
75
{
76
}
77
78
analysis_exceptiont::analysis_exceptiont
(std::string
reason
)
79
:
cprover_exception_baset
(
std
::move(
reason
))
80
{
81
}
82
83
invalid_input_exceptiont::invalid_input_exceptiont
(std::string
reason
)
84
:
cprover_exception_baset
(
std
::move(
reason
))
85
{
86
}
87
88
invalid_source_file_exceptiont::invalid_source_file_exceptiont
(
89
std::string
reason
,
90
source_locationt
source_location
)
91
:
invalid_input_exceptiont
(
std
::move(
reason
)),
92
source_location
(
std
::move(
source_location
))
93
{
94
}
95
96
std::string
invalid_source_file_exceptiont::what
()
const
97
{
98
return
source_location
.as_string() +
": "
+
reason
;
99
}
analysis_exceptiont::analysis_exceptiont
analysis_exceptiont(std::string reason)
Definition
exception_utils.cpp:78
cprover_exception_baset::what
virtual std::string what() const
A human readable description of what went wrong.
Definition
exception_utils.cpp:12
cprover_exception_baset::cprover_exception_baset
cprover_exception_baset(std::string reason)
This constructor is marked protected to ensure this class isn't used directly.
Definition
c_errors.h:76
cprover_exception_baset::reason
std::string reason
The reason this exception was generated.
Definition
c_errors.h:83
deserialization_exceptiont::deserialization_exceptiont
deserialization_exceptiont(std::string message)
Definition
exception_utils.cpp:47
incorrect_goto_program_exceptiont::source_location
source_locationt source_location
Definition
exception_utils.h:111
incorrect_goto_program_exceptiont::incorrect_goto_program_exceptiont
incorrect_goto_program_exceptiont(std::string message)
Definition
exception_utils.cpp:52
incorrect_goto_program_exceptiont::diagnostics
std::string diagnostics
Definition
exception_utils.h:113
incorrect_goto_program_exceptiont::what
std::string what() const override
A human readable description of what went wrong.
Definition
exception_utils.cpp:59
invalid_command_line_argument_exceptiont::invalid_command_line_argument_exceptiont
invalid_command_line_argument_exceptiont(std::string reason, std::string option, std::string correct_input="")
Definition
exception_utils.cpp:32
invalid_command_line_argument_exceptiont::what
std::string what() const override
A human readable description of what went wrong.
Definition
exception_utils.cpp:17
invalid_command_line_argument_exceptiont::correct_input
std::string correct_input
In case we have samples of correct input to the option.
Definition
exception_utils.h:56
invalid_command_line_argument_exceptiont::option
std::string option
The full command line option (not the argument) that got erroneous input.
Definition
exception_utils.h:54
invalid_input_exceptiont::invalid_input_exceptiont
invalid_input_exceptiont(std::string reason)
Definition
exception_utils.cpp:83
invalid_source_file_exceptiont::what
std::string what() const override
A human readable description of what went wrong.
Definition
exception_utils.cpp:96
invalid_source_file_exceptiont::invalid_source_file_exceptiont
invalid_source_file_exceptiont(std::string reason, source_locationt source_location)
Definition
exception_utils.cpp:88
invalid_source_file_exceptiont::source_location
source_locationt source_location
Definition
exception_utils.h:190
source_locationt
Definition
source_location.h:20
system_exceptiont::system_exceptiont
system_exceptiont(std::string message)
Definition
exception_utils.cpp:42
unsupported_operation_exceptiont::unsupported_operation_exceptiont
unsupported_operation_exceptiont(std::string message)
message is the unsupported operation causing this fault to occur.
Definition
exception_utils.cpp:72
exception_utils.h
std
STL namespace.
util
exception_utils.cpp
Generated by
1.17.0