GOLF(2gg)
GOLF(2gg) β db-error π
okay bestie, welcome to GOLF(2gg), the Development corner of the manual, and today's main character is db-error. she's short, she's powerful, she decides whether your program rage-quits or keeps it cute when the database does a little whoopsie. let's get into it π«Ά
β¨ NAME β¨
db-error β (database error-handling)
π― PURPOSE π―
Either exit request or continue processing when there is an error in a database statement. that's it. that's the whole job. tiny function, huge consequences, no cap π
π SYNTAX π
db-error [ @<database> ] ( exit | continue )
πΈ DESCRIPTION πΈ
so db-error sets the response to the failure of database statements. and the cute part? you can change this response at run-time with each execution of db-error. she's not a one-time decision, she's a vibe you can switch up whenever π¦
When a database statement (like run-query) fails, Golf will either exit request processing if "exit" is used, or continue if "continue" is used. and what do those actually mean, bestie? glad you asked:
"Exiting"is equivalent to callingreport-errorwith the message containing details about the error. so it's not just a silent flounce, she tells you what went wrong."Continuing"means that your program will continue but you should examine error code (see for instance"error"clause inrun-query). so like, she lets you keep going, but she is NOT covering for you. check that error code, i'm serious π
The default action is "exit". periodt. You can switch back and forth between "exit" and "continue" whenever you feel like it. Typically, "exit" is preferable because errors in database statemets generally mean application or setup issues β like, that's a real problem, not a lil glitch β however "continue" may be used when application wants to attempt to recover from errors or perform other actions. so if you're in your resilient queen era, continue is right there for you π
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. yes, per-statement overrides. she's flexible like that π
ποΈ 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). one database, no ambiguity, we don't do chaos here β¨
π 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
like, read that last part again bestie. every error. henceforth. i'm watching π§
π₯ 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
β οΈ quick vibe check: the default is"exit". if you switch to"continue"and then don't check your error codes, that's on you, not on her. she warned you. multiple times. lovingly. π
and that's the whole page, bestie!! this one's from the $VERSION era, dated $DATE, and it lives under GOLF(2gg). go forth and handle those database errors like the icon you are π
β¨π
π¦ where this page comes from
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms