GraphicsMagick

- Home
- Project
- Download
- Install
- Source
- News
- Utilities
- Programming
- Reference

# error

Error reporting methods

Contents

- CatchException

- CopyException

- DestroyExceptionInfo

- GetExceptionInfo

- GetLocaleExceptionMessage

- MagickError

- MagickFatalError

- MagickWarning

- SetErrorHandler

- SetExceptionInfo

- SetFatalErrorHandler

- SetWarningHandler

- ThrowException

- ThrowLoggedException

# CatchException

## Synopsis

    CatchException( const ExceptionInfo *exception );

## Description

CatchException() returns if no exceptions is found otherwise it reports the exception as a warning, error, or fatal depending on the severity.

The format of the CatchException method is:

    CatchException( const ExceptionInfo *exception );

A description of each parameter follows:

exception:

  The exception info.

# CopyException

## Synopsis

    void CopyException( ExceptionInfo *copy, const ExceptionInfo *original );

## Description

CopyException() copies exception data from one ExceptionInfo structure to another.

The format of the CopyException method is:

    void CopyException( ExceptionInfo *copy, const ExceptionInfo *original );

A description of each parameter follows:

copy:

  The exception to copy to.

original:

  The exception to copy from.

# DestroyExceptionInfo

## Synopsis

    void DestroyExceptionInfo( ExceptionInfo *exception );

## Description

DestroyExceptionInfo() deallocates memory associated with exception.

The format of the DestroyExceptionInfo method is:

    void DestroyExceptionInfo( ExceptionInfo *exception );

A description of each parameter follows:

exception:

  The exception info.

# GetExceptionInfo

## Synopsis

    GetExceptionInfo( ExceptionInfo *exception );

## Description

GetExceptionInfo() initializes an exception to default values.

The format of the GetExceptionInfo method is:

    GetExceptionInfo( ExceptionInfo *exception );

A description of each parameter follows:

exception:

  The exception info.

# GetLocaleExceptionMessage

## Synopsis

    const char *GetLocaleExceptionMessage( const ExceptionType severity, const char *tag );

## Description

GetLocaleExceptionMessage() converts a enumerated exception severity and tag to a message in the current locale.

The format of the GetLocaleExceptionMessage method is:

    const char *GetLocaleExceptionMessage( const ExceptionType severity, const char *tag );

severity:

  the severity of the exception.

tag:

  the message tag.

# MagickError

## Synopsis

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

## Description

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 );

exception:

  Specifies the numeric error category.

reason:

  Specifies the reason to display before terminating the program.

description:

  Specifies any description to the reason.

# MagickFatalError

## Synopsis

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

## Description

MagickFatalError() calls the fatal error handler methods with an error reason. The fatal error handler is not expected to return!

The format of the MagickFatalError method is:

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

exception:

  Specifies the numeric error category.

reason:

  Specifies the reason to display before terminating the program.

description:

  Specifies any description to the reason.

# MagickWarning

## Synopsis

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

## Description

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 );

warning:

  The warning severity.

reason:

  Define the reason for the warning.

description:

  Describe the warning.

# SetErrorHandler

## Synopsis

    ErrorHandler SetErrorHandler( ErrorHandler handler );

## Description

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:

  The method to handle errors.

# SetExceptionInfo

## Synopsis

    SetExceptionInfo( ExceptionInfo *exception, ExceptionType severity );

## Description

SetExceptionInfo() set the exception severity.

The format of the SetExceptionInfo method is:

    SetExceptionInfo( ExceptionInfo *exception, ExceptionType severity );

A description of each parameter follows:

exception:

  The exception info.

severity:

  The exception severity.

# SetFatalErrorHandler

## Synopsis

    FatalErrorHandler SetFatalErrorHandler( FatalErrorHandler handler );

## Description

SetFatalErrorHandler() sets the fatal error handler to the specified method and returns the previous fatal error handler.

The format of the SetFatalErrorHandler method is:

    FatalErrorHandler SetFatalErrorHandler( FatalErrorHandler handler );

A description of each parameter follows:

handler:

  The method to handle errors.

# SetWarningHandler

## Synopsis

    ErrorHandler SetWarningHandler( ErrorHandler handler );

## Description

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:

  The method to handle warnings.

# ThrowException

## Synopsis

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

## Description

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 );

exception:

  The exception.

severity:

  The severity of the exception.

reason:

  The reason of the exception.

description:

  The exception description.

# ThrowLoggedException

## Synopsis

    void ThrowLoggedException( ExceptionInfo *exception, const ExceptionType severity,
                               const char *reason, const char *description, const char *module,
                               const char *function, const unsigned long line ;

## Description

ThrowLoggedException() throws an exception with the specified severity code, reason, optional description, source filename, function name, and line number. If logging is enabled, the exception is also logged.

If the exception already contains an ErrorException (or greater) or the existing exception is more severe, then it is ignored.

The format of the ThrowLoggedException method is:

    void ThrowLoggedException( ExceptionInfo *exception, const ExceptionType severity,
                               const char *reason, const char *description, const char *module,
                               const char *function, const unsigned long line ;

exception:

  The exception.

severity:

  The severity of the exception.

reason:

  The reason of the exception.

description:

  The exception description.

filename:

  The source module filename.

function:

  The function name.

line:

  The line number of the source module.

Copyright © GraphicsMagick Group 2002-2025