WiredTiger operations return a value of 0 on success and a non-zero value on error. Error codes may be either positive or negative: positive error codes are standard error codes as described for POSIX-like systems (for example, EINVAL or EBUSY), negative error codes are WiredTiger-specific (for example, WT_ROLLBACK).
WiredTiger-specific error codes always appear in the -31,800 to -31,999 range.
Informational return values, like wiredtiger.WT_NOTFOUND
or wiredtiger.WT_DUPLICATE_KEY
or 0 (success), are directly returned by APIs. More severe errors are thrown as WiredTigerException
, which may be caught by the application.
The WiredTigerRollbackException
is a specific type of WiredTigerException
, it is thrown when there is a conflict between concurrent operations. An application that catches this exception should call rollback() on the relevant transaction, and retry as necessary.
The WiredTigerPanicException
is a specific type of WiredTigerException
, it is thrown when there is an underlying problem that requires the application to exit and restart.
The following is a complete list of possible WiredTiger-specific return values, all constants defined in the com.wiredtiger.db.wiredtiger class:
WT_PANIC
is returned from a WiredTiger interface, no further WiredTiger calls are required.The wiredtiger_strerror function returns the standard message associated with any WiredTiger, ISO C99, or POSIX 1003.1-2001 function: