cprover
Loading...
Searching...
No Matches
exception_utils.cpp
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#include "exception_utils.h"
10#include <utility>
11
13{
14 std::string res;
15 res += "Invalid User Input";
16 res += "\nOption: " + option;
17 res += "\nReason: " + reason;
18 // Print an optional correct usage message assuming correct input parameters have been passed
19 if(!correct_input.empty())
20 {
21 res += "\nSuggestion: " + correct_input;
22 }
23 return res;
24}
25
28 std::string reason,
29 std::string option,
30 std::string correct_input)
31 : reason(std::move(reason)),
32 option(std::move(option)),
33 correct_input(std::move(correct_input))
34{
35}
36
38 : message(std::move(message))
39{
40}
41
42std::string system_exceptiont::what() const
43{
44 return message;
45}
46
48 : message(std::move(message))
49{
50}
51
53{
54 return message;
55}
56
58 std::string message)
59 : message(std::move(message))
60{
62}
63
65{
66 std::string ret(message);
67
69 ret += " (at: " + source_location.as_string() + ")";
70
71 if(!diagnostics.empty())
72 ret += "\n" + diagnostics;
73
74 return ret;
75}
76
78 std::string message)
79 : message(std::move(message))
80{
81}
82
84{
85 return message;
86}
87
89 : reason(std::move(reason))
90{
91}
92
93std::string analysis_exceptiont::what() const
94{
95 return reason;
96}
97
99 std::string reason)
100 : reason(std::move(reason))
101{
102}
103
105{
106 return reason;
107}
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:564
std::string what() const override
A human readable description of what went wrong.
std::string reason
The reason this exception was generated.
analysis_exceptiont(std::string reason)
std::string what() const override
A human readable description of what went wrong.
deserialization_exceptiont(std::string message)
incorrect_goto_program_exceptiont(std::string message)
std::string what() const override
A human readable description of what went wrong.
invalid_command_line_argument_exceptiont(std::string reason, std::string option, std::string correct_input="")
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.
std::string what() const override
A human readable description of what went wrong.
invalid_source_file_exceptiont(std::string reason)
void make_nil()
Definition irep.h:454
bool is_nil() const
Definition irep.h:376
std::string as_string() const
system_exceptiont(std::string message)
std::string what() const override
A human readable description of what went wrong.
std::string what() const override
A human readable description of what went wrong.
std::string message
The unsupported operation causing this fault to occur.
unsupported_operation_exceptiont(std::string message)
STL namespace.