All errors thrown by the library are of this class. The implementation is "smart" to deal with a peculiarity of the C++ throw/catch mechanism. When an error of a derived class is thrown, but an object of the base class is caught, there is a potential loss of data. The thrown error is generally created on the process memory heap, the stack cut back to the catch statement state, and base class copy constructor is used to make a duplicate on the stack. When the catch block is exited, both the local copy and the original are destroyed. If the derived class contains useful data, this is not visible within the catch block.
To allow the library to store additional error info not described in the public base class structure, the base adco_cError class contains a private member mRealMe which is an adco_cError class pointer. Normal instances are constructed to point at themselves, but the constructor is protected, so only derived classes can be instanciated. For instances of the base class created via the copy constructor, mRealMe points to the original dervied error class instance. This allows the public methods to reach into the original error for additional info.
Methods
virtual const char* message() const;
Descriptive message describing the error.
virtual unsigned int msglen() const;
The length of the message text (not including the terminating null character).
API INTEGRATION CODING FOR DEVELOPERS
Error Event Class: adco_cError
Description
All errors thrown by the library are of this class. The implementation is "smart" to deal with a peculiarity of the C++ throw/catch mechanism. When an error of a derived class is thrown, but an object of the base class is caught, there is a potential loss of data. The thrown error is generally created on the process memory heap, the stack cut back to the catch statement state, and base class copy constructor is used to make a duplicate on the stack. When the catch block is exited, both the local copy and the original are destroyed. If the derived class contains useful data, this is not visible within the catch block.
To allow the library to store additional error info not described in the public base class structure, the base adco_cError class contains a private member mRealMe which is an adco_cError class pointer. Normal instances are constructed to point at themselves, but the constructor is protected, so only derived classes can be instanciated. For instances of the base class created via the copy constructor, mRealMe points to the original dervied error class instance. This allows the public methods to reach into the original error for additional info.
Methods