class Error
Inherited by: BadCast, IOError, LogicError, OutOfMemory, ParseError, RuntimeError, and UnicodeError.
Required header: <Eclog/Error.h>
The Error abstract class provides a consistent interface for the error inheritance hierarchy.
Each specific type of error has a corresponding named constant in the error code enumeration (See ErrorCodeEnum) and a unique identifier (See ErrorId).
Name | Description |
---|---|
isA | Checks if the error object is of a specific type. |
getId | Gets the identifier of the error. |
equals | Compares the error with another error. |
clone | Makes a copy of the error. |
message | Gets the error message. |
id | Returns the identifier of this class. |
Name | Description |
---|---|
cast | Converts an error object up and down along the inheritance hierarchy. |
template<typename T>
bool isA() const;
virtual bool isA(const ErrorId& id) const;
Checks if the error object is of a specific type (or a subtype of a specific type).
T
The type of error to compare to.
const
ErrorId&
id Reference to an error identifier.
bool
true if the error object is of the specific type, false otherwise.
virtual const ErrorId& getId() const;
Gets the identifier of the error.
ErrorId&
Reference to the identifier.
virtual bool equals(const Error* other, bool strict) const;
Compares the error with another error.
If strict is false, this function will compare only two error identifiers. Otherwise, the details of the two errors will be further compared.
const
Error*
other Pointer to another error.
bool
strict Strict mode.
bool
true if the error is equal to other, false otherwise.
virtual const Error* clone() const;
Makes a copy of the error object.
const
Error*
Pointer to the copy.
virtual const char* message() const;
Gets the error message.
const char*
The error message.
static const ErrorId& id();
Returns the identifier of this class.
ErrorId&
Reference to the identifier.
template<typename T>
const T& cast(const Error& err);
Converts an error object up and down along the inheritance hierarchy.
T
The type of error to cast to.
const
Error&
err An error object to cast.
const T&
Reference to the error object.
A BadCast
fault occurs if the error object is not of the specific type.