cimg_library::CImgException Struct Reference

Class which is thrown when an error occured during a CImg library function call. More...

#include <cimg.h>

Inheritance diagram for cimg_library::CImgException:

cimg_library::CImgArgumentException cimg_library::CImgDisplayException cimg_library::CImgInstanceException cimg_library::CImgIOException cimg_library::CImgWarningException

List of all members.

Public Member Functions

 CImgException ()
 CImgException (const char *format,...)

Public Attributes

char message [1024]
 Message associated with the error that thrown the exception.


Detailed Description

Class which is thrown when an error occured during a CImg library function call.

Overview

CImgException is the base class of CImg exceptions. Exceptions are thrown by the CImg Library when an error occured in a CImg library function call. CImgException is seldom thrown itself. Children classes that specify the kind of error encountered are generally used instead. These sub-classes are :

The parent class CImgException may be thrown itself when errors that cannot be classified in one of the above type occur. It is recommended not to throw CImgExceptions yourself, since there are normally reserved to CImg Library functions. CImgInstanceException, CImgArgumentException, CImgIOException and CImgDisplayException are simple subclasses of CImgException and are thus not detailled more in this reference documentation.

Exception handling

When an error occurs, the CImg Library first displays the error in a modal window. Then, it throws an instance of the corresponding exception class, generally leading the program to stop (this is the default behavior). You can bypass this default behavior by handling the exceptions yourself, using a code block try { ... } catch() { ... }. In this case, you can avoid the apparition of the modal window, by defining the environment variable cimg_debug to 0 before including the CImg header file. The example below shows how to cleanly handle CImg Library exceptions :
      #define cimg_debug 0     // Disable modal window in CImg exceptions.
      #define "CImg.h"
      int main() {
        try {
          ...; // Here, do what you want.
        }
        catch (CImgInstanceException &e) {
          std::fprintf(stderr,"CImg Library Error : %s",e.message);  // Display your own error message
          ...                                                        // Do what you want now.
        }
      }

Definition at line 1405 of file cimg.h.


Constructor & Destructor Documentation

cimg_library::CImgException::CImgException (  )  [inline]

Definition at line 1407 of file cimg.h.

cimg_library::CImgException::CImgException ( const char *  format,
  ... 
) [inline]

Definition at line 1408 of file cimg.h.

References cimg_exception_err.


Member Data Documentation

Message associated with the error that thrown the exception.

Definition at line 1406 of file cimg.h.

Referenced by lux::StandardImageReader< T >::read().


The documentation for this struct was generated from the following file:

Generated on Mon May 18 07:13:50 2009 for lux by  doxygen 1.5.8