From 780b92ada9afcf1d58085a83a0b9e6bc982203d1 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 17 Feb 2015 17:25:57 +0000 Subject: Imported from /home/lorry/working-area/delta_berkeleydb/db-6.1.23.tar.gz. --- docs/programmer_reference/env_error.html | 69 +++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 24 deletions(-) (limited to 'docs/programmer_reference/env_error.html') diff --git a/docs/programmer_reference/env_error.html b/docs/programmer_reference/env_error.html index 8170aebc..ba1e49a5 100644 --- a/docs/programmer_reference/env_error.html +++ b/docs/programmer_reference/env_error.html @@ -14,7 +14,7 @@ -

Berkeley DB offers programmatic support for displaying error return values. -The db_strerror() function returns a pointer to the error -message corresponding to any Berkeley DB error return. This is similar to the -ANSI C strerror interface, but can handle both system error returns and -Berkeley DB-specific return values.

-

For example:

+

+ Berkeley DB offers programmatic support for displaying error + return values. The db_strerror() function returns a pointer to + the error message corresponding to any Berkeley DB error + return. This is similar to the ANSI C strerror interface, but + can handle both system error returns and Berkeley DB-specific + return values. +

+

+ For example: +

int ret;
 if ((ret = dbenv->set_cachesize(dbenv, 0, 32 * 1024, 1)) != 0) {
@@ -51,15 +54,28 @@ if ((ret = dbenv->set_cachesize(dbenv, 0, 32 * 1024, 1)) != 0) {
     return (1);
 }
 
-

There are also two additional error methods: DB_ENV->err() and -DB_ENV->errx(). These methods work like the ANSI C printf function, -taking a printf-style format string and argument list, and writing a -message constructed from the format string and arguments.

-

The DB_ENV->err() function appends the standard error string to the -constructed message; the DB_ENV->errx() function does not.

-

Error messages can be configured always to include a prefix (for -example, the program name) using the DB_ENV->set_errpfx() method.

-

These functions provide simpler ways of displaying Berkeley DB error messages:

+

+ There are also two additional error methods: DB_ENV->err() and + DB_ENV->errx(). These methods + work like the ANSI C printf function, taking a printf-style + format string and argument list, and writing a message + constructed from the format string and arguments. +

+

+ The DB_ENV->err() function appends the standard error string to + the constructed message; the + DB_ENV->errx() function does + not. +

+

+ Error messages can be configured always to include a prefix + (for example, the program name) using the DB_ENV->set_errpfx() + method. +

+

+ These functions provide simpler ways of displaying Berkeley + DB error messages: +

int ret;
 ...
@@ -73,9 +89,12 @@ if ((ret = dbenv->open(dbenv, home,
         session_id);
     return (1);
 }
-

For example, if the program was called "my_app", and it tried to open -an environment home directory in "/tmp/home" and the open call returned -a permission error, the error messages shown would look like this:

+

+ For example, if the program was called "my_app", and it + tried to open an environment home directory in "/tmp/home" and + the open call returned a permission error, the error messages + shown would look like this: +

my_app: open: /tmp/home: Permission denied.
 my_app: contact your system administrator: session ID was 2
@@ -90,11 +109,13 @@ my_app: contact your system administrator: session ID was 2  Next - Opening databases within the environment  + Opening databases within the + environment  Home -  DB_CONFIG configuration file +  DB_CONFIG configuration + file -- cgit v1.2.1