Exception Handling

Exception class

The functions and classes in this library usually throw exceptions of Logs class (defined in cel_exception.h) except some special case.
Since all the codes that throw the exceptions also set appropriate error codes and messages to the Logs instances using celThrow or celThrow2 and you can get the information by Exception::what() and/or Exception::getError(). The following code illustrates the typical case for catching the exceptions:
    #include <cel_exception.h>

    ...

    try
    {
        // insert codes here
    }
    catch(Exception& e)
    {
        // output the error status.
        cout << e.what() << endl;
    }

The error message obtained by Exception::what() contains the source code point that throws the exception. And it is very useful when you're debugging the code or reporting bugs of the library to us.

Since Logs class inherits the std::exception class, you can also write the code like the following one:

    #include <exception>

    ...

    try
    {
        // insert codes here
    }
    catch(std::exception& e)
    {
        // output the error status.
        cout << e.what() << endl;
    }

This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:22:54 2008.