on-error
Purpose: Either exit request or continue processing when there is an error in executing a query.
on-error ( exit | continue ) [ @<database> ]
When a database statement (like
run-query) fails, either exit request processing if "exit" is used, or continue if "continue" is used. "Exiting" is equivalent to calling
report-error with the message containing details about the error. "Continuing" means that your program will continue but you should examine error code (see "error" clause in
run-query) and handle any issues.
The default action is "exit". You can switch back and forth between "exit" and "continue". Typically, "exit" is preferable because errors in database SQL code generally mean application issues, i.e. bugs that need fixing, however "continue" may be used when application wants to attempt to recover from errors or perform other actions.
Note that you can override the effect of on-error for a specific query by using "on-error-continue" and "on-error-exit" clauses in
run-query.
Database
Optional <database> is specified in "@" clause and is the name of the
database_config_file.
Examples
The following will not exit when errors happen but rather continue execution (and you must check every error henceforth):
See also
Database (
begin-transaction commit-transaction current-row database_config_file database_queries delete-query on-error prepared_statements query-result rollback-transaction run-query )
Error handling (
error_code error_handling on-error report-error )
SEE ALL (
documentation)