TIFFError

Synopsis

#include <tiffio.h>
#include <stdarg.h>
void TIFFError(const char *module, const char *fmt, ...)
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt, ...)
typedef void (*TIFFErrorHandler)(const char *module, const char *fmt, va_list ap)
typedef void (*TIFFErrorHandlerExt)(thandle_t fd, const char *module, const char *fmt, va_list ap)
TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler)
TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler)

Description

TIFFError() invokes the library-wide error handling function to (normally) write an error message to stderr. The fmt parameter is a printf() format string, and any number arguments can be supplied. The module parameter, if non-zero, is printed before the message; it typically is used to identify the software module in which an error is detected.

Applications that desire to capture control in the event of an error should TIFFSetErrorHandler() to override the default error handler. A NULL (0) error handling function may be installed to suppress error messages.

The function TIFFErrorExt() provides a file handle in order to write the error message to a file. Within libtiff TIFFErrorExt() is called using tif->tif_clientdata as file handle.

With TIFFSetErrorHandlerExt() an extra error handler can be setup in order to write to a file. The file handle needs to be stored in tif->tif_clientdata if the libtiff internal errors shall also be written to that file.

Note

In libtiff only a default error handler is defined, writing the message to stderr. For writing error messages to file, an extra TIFFErrorHandlerExt function has to be set. TIFFError() and TIFFErrorExt() will try to call both handler functions if defined. However, TIFFErrorExt() will pass "0" as file handle to the extended error handler.

Return values

TIFFSetErrorHandler() and TIFFSetErrorHandlerExt() returns a reference to the previous error handling function.

See also

TIFFWarning (3tiff), libtiff (3tiff), printf (3)