# Db::err

`

###

    #include <db_cxx.h>

    Db::err(int error, const char *fmt, ...);

    Db::errx(const char *fmt, ...);

# Description

The DbEnv::err, DbEnv::errx, Db::err and Db::errx methods provide error-messaging functionality for applications written using the Berkeley DB library.

The DbEnv::err method constructs an error message consisting of the following elements:

> An optional prefix string
>   If no error callback method has been set using the DbEnv::set_errcall method, any prefix string specified using the DbEnv::set_errpfx method, followed by two separating characters: a colon and a <space> character.

> An optional printf-style message
>   The supplied message fmt, if non-NULL, in which the ANSI C X3.159-1989 (ANSI C) printf function specifies how subsequent arguments are converted for output.

> A separator
>   Two separating characters: a colon and a <space> character.

> A standard error string
>   The standard system or Berkeley DB library error string associated with the error value, as returned by the DbEnv::strerror method.

This constructed error message is then handled as follows:

> If an error callback method has been set (see Db::set_errcall and DbEnv::set_errcall), that method is called with two arguments: any prefix string specified (see Db::set_errpfx and DbEnv::set_errpfx) and the error message.

> If a C library FILE * has been set (see Db::set_errfile and DbEnv::set_errfile), the error message is written to that output stream.

> If a C++ ostream has been set (see DbEnv::set_error_stream), the error message is written to that stream.

> If none of these output options has been configured, the error message is written to stderr, the standard error output stream.

The DbEnv::errx and Db::errx methods perform identically to the DbEnv::err and Db::err methods, except that they do not append the final separator characters and standard error string to the error message.

# Class

Db

# See Also

Db::associate, Db::close, Db::cursor, Db::del, Db::err, Db::errx Db::fd, Db::get, Db::pget, Db::get_byteswapped, Db::get_type, Db::join, Db::key_range, Db::open, Db::put, Db::remove, Db::rename, Db::set_alloc, Db::set_append_recno, Db::set_bt_compare, Db::set_bt_minkey, Db::set_bt_prefix, Db::set_cachesize, Db::set_dup_compare, Db::set_errcall, Db::set_errfile, Db::set_errpfx, Db::set_feedback, Db::set_flags, Db::set_h_ffactor, Db::set_h_hash, Db::set_h_nelem, Db::set_lorder, Db::set_pagesize, Db::set_paniccall, Db::set_q_extentsize, Db::set_re_delim, Db::set_re_len, Db::set_re_pad, Db::set_re_source, Db::stat, Db::sync, Db::truncate, Db::upgrade, and Db::verify.`

Copyright Sleepycat Software