one way of doing is to have a file with defined errors, and then just trowing them, and catch them as ints
something like this:
or you could make an exception class and derive all kinds of classes from it. and throw the classes and catch them as exceptions like:
#define DivideByZero 23123
if(e == DivideByZero)
Or something similar im not on a computer with a compiler at the moment.
string s; // to store the error message
//other vars/functions if you want
class DevideByZero : public Exception
//in constructor set s to someting like "Cannot Devide by Zero"