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 return reason;
15}
16
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
41
43 : cprover_exception_baset(std::move(message))
44{
45}
46
51
58
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
77
82
87
95
97{
98 return source_location.as_string() + ": " + reason;
99}
analysis_exceptiont(std::string reason)
virtual std::string what() const
A human readable description of what went wrong.
cprover_exception_baset(std::string reason)
This constructor is marked protected to ensure this class isn't used directly.
Definition c_errors.h:76
std::string reason
The reason this exception was generated.
Definition c_errors.h:83
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 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.
invalid_input_exceptiont(std::string reason)
std::string what() const override
A human readable description of what went wrong.
invalid_source_file_exceptiont(std::string reason, source_locationt source_location)
system_exceptiont(std::string message)
unsupported_operation_exceptiont(std::string message)
message is the unsupported operation causing this fault to occur.
STL namespace.