13 #ifndef ERROR_MESSAGES_H
14 #define ERROR_MESSAGES_H
75 error_msg(
const char * code,
const char * msg, ...) {
81 va_start( args, msg );
82 char *buffer =
new char[1024];
85 len = vsnprintf(buffer, 1024, msg, args ) + 1;
86 if (len == 0)
throw error_msg(
"OUTPUT",
"Output does not work :-(");
97 errors_stack.push_back(err);
110 void add(
string code,
string msg) {
120 for (i = 0; i < errors_stack.size(); i++) {
122 result = result + errors_stack[i].code +
": " + errors_stack[i].msg +
"\n";
void add(single_error err)
Definition: error.h:96
string code
Error code.
Definition: error.h:29
vector< single_error > errors_stack
Stack of errors.
Definition: error.h:57
string what()
Definition: error.h:117
error_msg(char *code)
Definition: error.h:64
error_msg(const char *code, const char *msg,...)
Definition: error.h:75
single_error(string code)
Constructor.
Definition: error.h:35
string msg
Error message.
Definition: error.h:32
single_error(string code, string msg)
Constructor.
Definition: error.h:42
Hold some information about an error in the code.
Definition: error.h:26
Error message - stack of single_errors.
Definition: error.h:54
void add(string code)
Definition: error.h:103
void add(string code, string msg)
Definition: error.h:110