Purpose: Either exit request or continue processing when there is an error in a database statement.
db-error [ @<database> ] ( exit | continue )
Copied!
db-error sets the response to the failure of database statements. You can change this response at run-time with each execution of db-error.
When a database statement (like run-query) fails, Gliimly will 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 for instance "error" clause in run-query).
The default action is "exit". You can switch back and forth between "exit" and "continue". Typically, "exit" is preferable because errors in database statemets generally mean application or setup issues, 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 db-error for a specific database statement by using clauses like "on-error-continue" and "on-error-exit" in run-query.
Database
<database> is specified in "@" clause and is the name of the database-config-file. If ommited, your program must use exactly one database (see --db option in gg).
Examples
The following will not exit when errors happen going forward, but rather continue execution (and you should check every error henceforth):