16 #define internal_TRY_nomem(code) \
22 std::cerr << err_nomem; \
24 std::cerr << err_unknown; \
40 const std::string a_what,
42 const std::string a_where,
44 const std::string a_file,
74 const std::string a_what,
76 const std::string a_where,
78 const std::string a_file,
110 const std::string error_instance::where(
void)
const
169 const bool a_internal
174 internal(a_internal);
218 type::push_back(a_e);
221 std::cerr <<
"*** ERROR: ";
224 <<
"[" << errno <<
"]: "
230 std::cerr <<
"error::push_back() failed" << std::endl;
236 error::const_iterator ei;
238 for (ei = a_e.begin(); ei != a_e.end(); ei++) {
258 for (eii = a_e.begin(); eii != a_e.end(); eii++) {
275 if (a_prefix.size() != 0)
276 a_out << a_prefix <<
" ";
279 a_out <<
"INTERNAL ";
286 for (eii = begin(); eii != end(); ++eii) {
287 if (a_prefix.size() != 0)
288 a_out << a_prefix <<
" ";
289 if (eii->what().size() != 0)
290 a_out <<
" " << eii->what() << std::endl;
294 a_out <<
"in " << eii->where() <<
" ";
296 a_out <<
"at " << eii->file() <<
"[" << eii->line() <<
"]";
304 const std::string
error::str(
const std::string a_prefix)
const
306 static const size_t buffer_len = 32;
307 char buffer[buffer_len] = { 0 };
313 if (a_prefix.size() != 0) {
322 snprintf(buffer, buffer_len,
"%d",
m_errno);
331 for (eii = begin(); eii != end(); ++eii) {
332 if (a_prefix.size() != 0)
333 es += a_prefix +
" ";
334 if (eii->what().size() != 0) {
339 snprintf(buffer, buffer_len,
"%u", eii->line());
386 return(a_e.
write(a_out));
391 return(strerror(a_err));
void assign(const error &a_e)
Basic types definitions and templates.
const bool internal(void) const
std::ostream & write(std::ostream &a_out, const std::string a_prefix="") const
error_instance & operator=(const error_instance &a_e)
const char * get_error_str(const int a_err)
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)
const uint16 line(void) const
#define internal_TRY_nomem(code)
const std::string what(void) const
const std::string file(void) const
std::ostream & operator<<(std::ostream &a_out, const error &a_e)
error & operator=(const error &a_e)
#define ERROR_INSTANCE(s)
const std::string str(const std::string a_prefix="") const