I'm making a simple Error
class that should be thrown using throw
statement, logged or written in console. The basic idea of the usage is:
//const char* filename is function argument
if(!file_exists(filename))
throw Error(line, file, severity)<<"Invalid argument: the file does not exist: "<<filename;
I originally wanted to extend stringstream
, but my searches indicate that it's impossible to extend on streams.
I'd really like to make the error class as convenient as you can see above, which means able to "eat" various types and append them to internal error message.