# Error Handling

## Enumerations

enum | ppl_enum_error_code { PPL_ERROR_OUT_OF_MEMORY, PPL_ERROR_INVALID_ARGUMENT, PPL_ERROR_DOMAIN_ERROR, PPL_ERROR_LENGTH_ERROR, PPL_ARITHMETIC_OVERFLOW, PPL_STDIO_ERROR, PPL_ERROR_INTERNAL_ERROR, PPL_ERROR_UNKNOWN_STANDARD_EXCEPTION, PPL_ERROR_UNEXPECTED_ERROR, PPL_TIMEOUT_EXCEPTION, PPL_ERROR_LOGIC_ERROR }
| Defines the error codes that any function may return. More...

## Functions

int | ppl_set_error_handler (void(*h)(enum ppl_enum_error_code code, const char *description))
| Installs the user-defined error handler pointed at by `h`.

## Detailed Description

Symbolic constants and functions related to error reporting/handling.

## Enumeration Type Documentation

enum ppl_enum_error_code

Defines the error codes that any function may return.

Enumerator:

  PPL_ERROR_OUT_OF_MEMORY | The virtual memory available to the process has been exhausted.
  PPL_ERROR_INVALID_ARGUMENT | A function has been invoked with an invalid argument.
  PPL_ERROR_DOMAIN_ERROR | A function has been invoked outside its domain of definition.
  PPL_ERROR_LENGTH_ERROR | The construction of an object that would exceed its maximum permitted size was attempted.
  PPL_ARITHMETIC_OVERFLOW | An arithmetic overflow occurred and the computation was consequently interrupted. This can only happen in library's incarnations using bounded integers as coefficients.
  PPL_STDIO_ERROR | An error occurred during a C input/output operation. A more precise indication of what went wrong is available via `errno`.
  PPL_ERROR_INTERNAL_ERROR | An internal error that was diagnosed by the PPL itself. This indicates a bug in the PPL.
  PPL_ERROR_UNKNOWN_STANDARD_EXCEPTION | A standard exception has been raised by the C++ run-time environment. This indicates a bug in the PPL.
  PPL_ERROR_UNEXPECTED_ERROR | A totally unknown, totally unexpected error happened. This indicates a bug in the PPL.
  PPL_TIMEOUT_EXCEPTION | An exception has been raised by the PPL as a timeout previously set by the user has expired.
  PPL_ERROR_LOGIC_ERROR | The client program attempted to use the PPL in a way that violates its internal logic. This happens, for instance, when the client attempts to use the timeout facilities on a system that does not support them.

## Function Documentation

int ppl_set_error_handler | ( | void(*)(enum ppl_enum_error_code code, const char *description) | h | ) |

Installs the user-defined error handler pointed at by `h`.

The error handler takes an error code and a textual description that gives further information about the actual error. The C string containing the textual description is read-only and its existence is not guaranteed after the handler has returned.