### Berkeley DB Reference Guide: Debugging |

# Run-time error information

Normally, when an error occurs in the Berkeley DB library, an integer value (either a Berkeley DB specific value, or a system errno value) is returned by the function. In some cases, however, this value may be insufficient to completely describe the cause of the error, especially during initial application debugging.

There are four interfaces intended to provide applications with additional run-time error information. They are DBENV->set_errcall, DBENV->set_errfile, DBENV->set_errpfx and DBENV->set_verbose.

If the environment is configured with these interfaces, many Berkeley DB errors will result in additional information being written to a file or passed as an argument to an application function.

The Berkeley DB error reporting facilities do not slow performance or significantly increase application size, and may be run during normal operation as well as during debugging. Where possible, we recommend that these options always be configured and the output saved in the filesystem. We have found that that this often saves time when debugging installation or other system integration problems.

In addition, there are three routines to assist applications in displaying their own error messages: db_strerror, DBENV->err and DBENV->errx. The first is a superset of the ANSI C strerror interface, and returns a descriptive string for any error return from the Berkeley DB library. The DBENV->err and DBENV->errx functions use the error message configuration options described above to format and display error messages to appropriate output devices.

Copyright Sleepycat Software