23 const std::string a_what,
25 const std::string a_where,
27 const std::string a_file,
35 const std::string a_what,
37 const std::string a_where,
39 const std::string a_file,
43 const std::string
what(
void)
const;
45 const std::string where(
void)
const;
47 const std::string
file(
void)
const;
48 const uint16
line(
void)
const;
64 #define ERROR_INSTANCE(s) \
65 error_instance((s), __PRETTY_FUNCTION__, __FILE__, __LINE__)
67 #define ERROR_INSTANCE(s) \
68 error_instance((s), __FILE__, __LINE__)
72 class error :
public std::vector<error_instance>
75 typedef std::vector<error_instance>
type;
77 error(
const int a_errno);
81 const bool a_internal =
false
87 void internal(
bool a_i);
88 const bool internal(void)
const;
99 const std::string a_prefix =
""
101 const std::string
str(
const std::string a_prefix =
"")
const;
114 #define err_unknown INTERNAL_ERROR(0,"An unknown error has occured")
116 #define err_nomem ERROR(ENOMEM,"Out of memory")
121 error(e,ERROR_INSTANCE((s)), false)
123 #define INTERNAL_ERROR(e,s) \
124 error(e,ERROR_INSTANCE(s), true)
126 #define TRY(code,es) \
131 e.push_back(ERROR_INSTANCE(es)); \
135 if (errno == ENOMEM) { \
138 error e = err_unknown; \
144 #define TRY_nomem(code) \
152 if (errno == ENOMEM) { \
155 throw(err_unknown); \
158 #define TRY_instead(code,es) \
164 e.push_back(ERROR_INSTANCE(es)); \
168 if (errno == ENOMEM) { \
171 error e = err_unknown; \
177 #define TRY_log(code,es) \
183 e.push_back(ERROR_INSTANCE(es)); \
184 logger.write(e.str()); \
187 if (errno == ENOMEM) { \
190 error e = err_unknown; \
193 logger.write(e.str()); \
void assign(const error &a_e)
Basic types definitions and templates.
std::ostream & write(std::ostream &a_out, const std::string a_prefix="") const
error_instance & operator=(const error_instance &a_e)
Instance of a single error containing a descriptive error message and the location in the file that t...
void push_back(const error_instance &a_e)
std::ostream & operator<<(std::ostream &a_out, const error &a_e)
const uint16 line(void) const
const std::string what(void) const
const std::string file(void) const
const char * get_error_str(const int a_err)
std::vector< error_instance > type
error & operator=(const error &a_e)
const std::string str(const std::string a_prefix="") const