logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

db-error - (database error-handling)

Description

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, Golf 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 omitted, 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): db-error @mydb continue

Name

db-error - (database error-handling)

Purpose

Either exit request or continue processing when there is an error in a database statement.

See Also

Database begin-transactioncommit-transactioncurrent-rowdatabase-config-filedb-errormariadb-databasepostgresql-databaserollback-transactionrun-querysqlite-database Error handling db-errorerror-codeerror-handlingreport-error See all documentation $DATE $VERSION GOLF(2gg)

Syntax

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

See Also