# DB->set_paniccall

`

###

    #include <db.h>

    int
    DB->set_paniccall(DB *db,
        void (*paniccall)(DB_ENV *, int errval));

# Description

Errors can occur in the Berkeley DB library where the only solution is to shut down the application and run recovery. (For example, if Berkeley DB is unable to write log records to disk because there is insufficient disk space.) In these cases, the value DB_RUNRECOVERY is returned by Berkeley DB.

In these cases, it is also often simpler to shut down the application when such errors occur rather than attempting to gracefully return up the stack. The DB->set_paniccall function is used to specify a function to be called when DB_RUNRECOVERY is about to be returned from a Berkeley DB method. When called, the dbenv argument will be a reference to the current environment, and the errval argument is the error value that would have been returned to the calling function.

For DB handles opened inside of Berkeley DB environments, calling the DB->set_paniccall function affects the entire environment and is equivalent to calling the DBENV->set_paniccall function.

The DB->set_paniccall interface may be used to configure Berkeley DB at any time during the life of the application.

The DB->set_paniccall function returns a non-zero error value on failure and 0 on success.

# See Also

DBENV->close, db_env_create, DBENV->open, DBENV->remove, DBENV->err, db_strerror, db_version, DBENV->set_cachesize, DBENV->set_errcall, DBENV->set_errfile, DBENV->set_errpfx, DBENV->set_flags, DBENV->set_mutexlocks, DBENV->set_paniccall, and DBENV->set_verbose.`

Copyright Sleepycat Software