#include <string>#include <iostream>#include <sstream>#include <iomanip>#include <errno.h>#include <string.h>#include "error.h"Include dependency graph for error.cc:

Go to the source code of this file.
Functions | |
| void | real_fail_neg (int eval, const char *eval_str, const char *func, const char *file, int line) |
| void | real_fail_null (const void *eval, const char *eval_str, const char *func, const char *file, int line) |
| error handler for NULL result codes | |
| void | real_fail_if (bool eval, const char *eval_str, const char *func, const char *file, int line) |
|
||||||||||||||||||||||||
|
Definition at line 88 of file error.cc. 00089 {
00090 if ( eval == true )
00091 {
00092
00093 string exc;
00094 ostringstream sb;
00095
00096 sb << file << ":" << line << ": In function \"" << func << "\": condition \"" << eval_str << "\" is true";
00097 if ( errno != 0 )
00098 sb << endl << file << ":" << line << ": errno: " << errno << " (" << strerror( errno ) << ")";
00099 sb << ends;
00100 exc = sb.str();
00101 cerr << exc << endl;
00102 throw exc;
00103 }
00104 }
|
|
||||||||||||||||||||||||
|
Definition at line 47 of file error.cc. 00048 {
00049 if ( eval < 0 )
00050 {
00051 string exc;
00052 ostringstream sb;
00053
00054 sb << file << ":" << line << ": In function \"" << func << "\": \"" << eval_str << "\" evaluated to " << eval;
00055 if ( errno != 0 )
00056 sb << endl << file << ":" << line << ": errno: " << errno << " (" << strerror( errno ) << ")";
00057 sb << ends;
00058 exc = sb.str();
00059 cerr << exc << endl;
00060 throw exc;
00061 }
00062 }
|
|
||||||||||||||||||||||||
|
error handler for NULL result codes Whenever this is called with a NULL argument, it will throw an exception. Typically used with functions like malloc() and new(). Definition at line 72 of file error.cc. 00073 {
00074 if ( eval == NULL )
00075 {
00076
00077 string exc;
00078 ostringstream sb;
00079
00080 sb << file << ":" << line << ": In function \"" << func << "\": " << eval_str << " is NULL" << ends;
00081 exc = sb.str();
00082 cerr << exc << endl;
00083 throw exc;
00084 }
00085 }
|
1.4.2