Error handling

Error management

wreport defines its own exception hierarchy, rooted at wreport::error.

Each wreport exception has a numeric identification code:

enum wreport::ErrorCode

C-style error codes used by exceptions.

Values:

WR_ERR_NONE = 0

No error.

WR_ERR_NOTFOUND = 1

Item not found.

WR_ERR_TYPE = 2

Wrong variable type.

WR_ERR_ALLOC = 3

Cannot allocate memory.

WR_ERR_ODBC = 4

ODBC error.

WR_ERR_HANDLES = 5

Handle management error.

WR_ERR_TOOLONG = 6

Buffer is too short to fit data.

WR_ERR_SYSTEM = 7

Error reported by the system.

WR_ERR_CONSISTENCY = 8

Consistency check failed.

WR_ERR_PARSE = 9

Parse error.

WR_ERR_WRITE = 10

Write error.

WR_ERR_REGEX = 11

Regular expression error.

WR_ERR_UNIMPLEMENTED = 12

Feature not implemented.

WR_ERR_DOMAIN = 13

Value outside acceptable domain.

The exceptions are:

class error : public std::exception

Base class for DB-All.e exceptions.

Subclassed by wreport::errors::StringBase< WR_ERR_CONSISTENCY >, wreport::errors::StringBase< WR_ERR_DOMAIN >, wreport::errors::StringBase< WR_ERR_HANDLES >, wreport::errors::StringBase< WR_ERR_NOTFOUND >, wreport::errors::StringBase< WR_ERR_PARSE >, wreport::errors::StringBase< WR_ERR_REGEX >, wreport::errors::StringBase< WR_ERR_SYSTEM >, wreport::errors::StringBase< WR_ERR_TOOLONG >, wreport::errors::StringBase< WR_ERR_TYPE >, wreport::errors::StringBase< WR_ERR_UNIMPLEMENTED >, wreport::error_alloc, wreport::errors::StringBase< ERROR_CODE >

Public Functions

virtual ErrorCode code() const = 0

Exception-specific error code.

This is useful to map C++ exceptions to C or Fortran error codes

virtual const char *what() const = 0

Error message.

Public Static Functions

static const char *strerror(ErrorCode code)

String description for an error code.

class error_alloc : public wreport::error

Reports that memory allocation has failed.

class error_notfound : public wreport::errors::StringBase<WR_ERR_NOTFOUND>

Reports that a search-like function could not find what was requested.

class error_type : public wreport::errors::StringBase<WR_ERR_TYPE>

For functions handling data with multiple types, reports a mismatch between the type requested and the type found.

class error_handles : public wreport::errors::StringBase<WR_ERR_HANDLES>

For functions working with handles, reports a problem with handling handles, such as impossibility to allocate a new one, or an invalid handle being passed to the function.

class error_toolong : public wreport::errors::StringBase<WR_ERR_TOOLONG>

Report an error with a buffer being to short for the data it needs to fit.

class error_system : public wreport::errors::StringBase<WR_ERR_SYSTEM>

Report a system error message.

The message description will be looked up using the current value of errno.

class error_consistency : public wreport::errors::StringBase<WR_ERR_CONSISTENCY>

Report an error when a consistency check failed.

class error_parse : public wreport::errors::StringBase<WR_ERR_PARSE>

Report an error when parsing informations.

class error_regexp : public wreport::errors::StringBase<WR_ERR_REGEX>

Report an error while handling regular expressions.

class error_unimplemented : public wreport::errors::StringBase<WR_ERR_UNIMPLEMENTED>

Reports that a feature is still not implemented.

class error_domain : public wreport::errors::StringBase<WR_ERR_DOMAIN>

Report that a parameter is outside the acceptable domain.