Next: 3.8 Joining operations together Up: 3. The VIPS image Previous: 3.6.3 Other local operations Contents

# 3.7 Error handling

All VIPS operations return 0 on success and non-zero on error, setting `im_errorstring()` with the function `im_errormsg()`. 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_errormsg()` to let your caller know what the problem was.

VIPS provides two more functions for error message handling: `im_warning()` and `im_diagnostics()`. 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.

A final tricky issue is internationalization. All VIPS error messages are currently in (sometimes rather poor) English. We hope to add an error code system together with a simple error message database in the future.

Next: 3.8 Joining operations together Up: 3. The VIPS image Previous: 3.6.3 Other local operations Contents