# Error Handling

## General

With the settings PRINT_ERRORS and PRINT_WARNINGS (in the file const.php) you can control if errors are printed.
Independent of this settings the Text-Db-Api manages an error stack. This is an array which contains all errors.
To do this, the Text-Db-Api sets its own PHP error handler. This error handler catches all errors and stores
them in the error stack and depending on the configuration these errors are printed out or not.
The error handler is set in the executeQuery() function and removed at the end of this function.
Also, each time you call executeQuery() the error stack will be cleared, this has the adventage that you
only have errors of the last executeQuery() call in the stack.

With the following functions you can query errors and clear the stack:

txtdbapi_clear_errors
txtdbapi_error_occurred
txtdbapi_get_errors
txtdbapi_get_last_error

Its also important to mention that the Text-Db-Api error handler also catches an stores all PHP Errors
(which occur in executeQuery) in the stack. So if you set PRINT_ERRORS and PRINT_WARNINGS to 0, you
should not see any error messages which occur in executeQuery().