61 #define undefined_error 1000 62 #define unknown_error 1001 63 #define internal_error 1002 64 #define no_such_file 1003 65 #define no_such_variable 1004 66 #define malformed_expr 1005 67 #define no_authorization 1006 68 #define cannot_read_file 1007 69 #define not_implemented 1008 70 #define dummy_message 1009 92 class Error :
public std::exception
95 ErrorCode _error_code;
96 std::string _error_message;
102 Error(ErrorCode ec, std::string msg, std::string file =
"",
int line = 0);
103 Error(std::string msg, std::string file =
"",
int line = 0);
108 virtual ~
Error()
throw();
113 bool parse(FILE *fp);
114 void print(FILE *out)
const;
115 void print(std::ostream &out)
const;
121 std::string get_file()
const {
return d_file; }
122 void set_file(std::string f) { d_file = f; }
123 int get_line()
const {
return d_line; }
124 void set_line(
int l) { d_line = l; }
127 virtual const char*
what()
const throw() {
128 return _error_message.c_str();
void set_error_message(std::string msg="")
bool parse(FILE *fp)
Parse an Error object.
void set_error_code(ErrorCode ec=undefined_error)
top level DAP object to house generic methods
bool OK() const
Is the Error object valid?
ErrorCode get_error_code() const
std::string get_error_message() const
int ErrorCode
An enumerated type for common errors.
void print(FILE *out) const
virtual const char * what() const
The pointer is valid only for the lifetime of the Error instance. jhrg 9/22/20.
A class for error processing.