Vely logo Empower C
install  tutorials  examples
documentation  license  about

12.1.0 released on Sep 19, 2022

on-error



PURPOSE:


Either exit request or continue processing when there is an error in executing a query.

SYNTAX:


on-error ( exit | continue ) [ @<database> ]


DESCRIPTION:


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):
on-error continue @mydb


SEE ALSO:


Database ( begin-transaction   commit-transaction   current-row   database_config_file   database_queries   on-error   prepared_statements   query-result   rollback-transaction   run-query  )  Error handling ( error_code   error_handling   on-error   report-error  )  SEE ALL (documentation)



Copyright (c) 2022 DaSoftver LLC. Vely is a trademark of Dasoftver LLC. The software and information herein are provided "AS IS" and without any warranties or guarantees of any kind. Icons copyright PaweĊ‚ Kuna licensed under MIT. This web page is licensed under CC-BY-SA-4.0.