Exception Handling

Exception class

The functions and classes in this library usually throw exceptions of Exception 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 Exception 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
}
{
// 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 Exception 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;
}

Using Exception with pure C code on UNIX platform

On UNIX platforms, since gcc does not care about C++ exception frame, exceptions might be lost during round-tripping through pure C libraries. Because of such issues, this library is linked against our own version of several libraries instead of using system provided one. Fore more information, see Special Version of Libraries for Exception Handling.


Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo