enum Code
{
- NONE = 0,
+ UNINITIALIZED = -1, // -
+ NONE = 0, // -
ALC_INIT, // description
FASTEVENTS_INIT, // description
+ OPENAL_INIT, // description
FILE_NOT_FOUND, // path of missing file
RESOURCE_NOT_FOUND, // name of missing resource
SCRIPT_ERROR, // description
UNKNOWN_IMAGE_FORMAT, // name of resource
};
- explicit Error(unsigned code, const std::string& what = "")
+ explicit Error(unsigned code = NONE, const std::string& what = "")
{
init(code, what);
}
mCode = code;
}
- virtual void raise()
+ virtual void raise() const
{
throw *this;
}
return mWhat;
}
- bool isError() const throw()
+ operator bool () const
{
+ // resolves to true if error code is not NONE
return mCode != NONE;
}
+ void reset() throw()
+ {
+ mCode = NONE;
+ mWhat[0] = '\0';
+ }
+
private:
unsigned mCode;