error - ImageMagick Error Methods

- NAME
- SYNOPSIS
- FUNCTION DESCRIPTIONS

- CatchImageException
- DestroyExceptionInfo
- GetExceptionInfo
- GetImageException
- MagickError
- MagickWarning
- SetErrorHandler
- SetWarningHandler
- ThrowException

# NAME

error - ImageMagick Error Methods

# SYNOPSIS

CatchImageException( Image *image );

void DestroyExceptionInfo( ExceptionInfo *exception );

GetExceptionInfo( ExceptionInfo *exception );

GetImageException( Image *image, ExceptionInfo *exception );

void MagickError( const ExceptionType error, const char *reason, const char *description );

void MagickWarning( const ExceptionType warning, const char *reason, const char *description );

ErrorHandler SetErrorHandler( ErrorHandler handler );

ErrorHandler SetWarningHandler( ErrorHandler handler );

void ThrowException( ExceptionInfo *exception, const ExceptionType severity, const char *reason, const char *description );

# FUNCTION DESCRIPTIONS

## CatchImageException

Method CatchImageException returns if no exceptions are found in the image sequence, otherwise it determines the most severe exception and reports it as a warning or error depending on the severity.

The format of the CatchImageException method is:

> CatchImageException ( Image *image );

A description of each parameter follows:

image:
  Specifies a pointer to a list of one or more images.

## DestroyExceptionInfo

Method DestroyExceptionInfo deallocates memory associated with an ExceptionInfo structure.

The format of the DestroyExceptionInfo method is:

> void DestroyExceptionInfo ( ExceptionInfo *exception );

A description of each parameter follows:

exception:
  Specifies a pointer to an ExceptionInfo structure.

## GetExceptionInfo

Method GetExceptionInfo initializes the ExceptionInfo structure.

The format of the GetExceptionInfo method is:

> GetExceptionInfo ( ExceptionInfo *exception );

A description of each parameter follows:

error_info:
  Specifies a pointer to a ExceptionInfo structure.

## GetImageException

Method GetImageException traverses an image sequence and returns any error more severe than noted by the exception parameter.

The format of the GetImageException method is:

> GetImageException ( Image *image, ExceptionInfo *exception );

A description of each parameter follows:

image:
  Specifies a pointer to a list of one or more images.

exception:
  return the highest severity exception.

## MagickError

Method MagickError calls the error handler methods with an error reason.

The format of the MagickError method is:

> void MagickError ( const ExceptionType error, const char *reason, const char *description );

A description of each parameter follows:

exception:
  Specifies the numeric error category.

reason:
  Specifies the reason to display before terminating the program.

description:
  Specifies any description to the reason.

## MagickWarning

Method MagickWarning calls the warning handler methods with a warning reason.

The format of the MagickWarning method is:

> void MagickWarning ( const ExceptionType warning, const char *reason, const char *description );

A description of each parameter follows:

warning:
  Specifies the numeric warning category.

reason:
  Specifies the reason to display before terminating the program.

description:
  Specifies any description to the reason.

## SetErrorHandler

Method SetErrorHandler sets the error handler to the specified method and returns the previous error handler.

The format of the SetErrorHandler method is:

> ErrorHandler SetErrorHandler ( ErrorHandler handler );

A description of each parameter follows:

handler:
  Specifies a pointer to a method to handle errors.

## SetWarningHandler

Method SetWarningHandler sets the warning handler to the specified method and returns the previous warning handler.

The format of the SetWarningHandler method is:

> ErrorHandler SetWarningHandler ( ErrorHandler handler );

A description of each parameter follows:

handler:
  Specifies a pointer to a method to handle warnings.

## ThrowException

Method ThrowException throws an exception with the specified severity code, reason, and optional description.

The format of the ThrowException method is:

> void ThrowException ( ExceptionInfo *exception, const ExceptionType severity, const char *reason, const char *description );

A description of each parameter follows:

exception:
  Specifies a pointer to the ExceptionInfo structure.

severity:
  This ExceptionType declares the severity of the exception.

reason:
  Specifies the reason to display before terminating the program.

description:
  Specifies any description to the reason.