All VIPS operations return 0 on success and non-zero on error, setting
im_error()
. As a consequence, when a VIPS function fails, you do not
need to generate an error message -- you can simply propogate the error back
up to your caller. If however you detect some error yourself (for example,
the bad parameter in the example above), you must call im_error()
to let your caller know what the problem was.
VIPS provides two more functions for error message handling: im_warn()
and im_diag()
. These are intended to be used for less serious
messages, as their names suggest. Currently, they simply format and print
their arguments to stderr
, optionally supressed by the setting of an
environment variable. Future releases of VIPS may allow more sophisticated
trapping of these functions to allow their text to be easily presented to
the user by VIPS applications. See the manual pages.