GOLF(2gg)
π GOLF(2gg) β the development manual, bestie edition π
okay so you're in the GOLF(2gg) dev manual, section Development, and today's main character is a little function called report-error. she's dramatic, she's fatal, she's here to ruin (or save) your day. let's get into it π
β¨ NAME β¨
report-error β (error-handling)
πΈ PURPOSE πΈ
She reports a fatal error. that's it. that's the whole job. no cap.
π¦ SYNTAX π¦
report-error <format>, <variable> [ , ... ]
π DESCRIPTION π
so report-error will report a fatal error. it takes your <format> string plus a whole lil squad of <variable>s, formats an error message out of them, and then writes that message into the trace file (peep directories for the deets). and here's the iconic part: this happens regardless of whether tracing is enabled or not. tracing off? don't care. she's writing anyway. π
also, go look at error-handling for the moment when report-error gets called, iykyk.
now, the <format> string is mandatory, and you need at least one <variable>. yes, even if you're just tracing a plain string literal β you STILL have to use "%s" as the format. like, you don't get to skip it. the reason? it avoids formatting errors and keeps formatting consistent across the board. queen behavior honestly. β¨
π FORMAT π
the <format> string must be a literal. then your variables follow <format>, separated by commas, in the same order as the placeholders. and listen β if you use any placeholders other than the ones listed below, or the types of your variables don't match the types of the corresponding placeholders in <format>, your program will error out. no warning, no vibe check, just death. π
these are the placeholders you're allowed to use in <format> (and psst β check trace-run for an example of usage):
%sβ for a string%cβ for a number displayed as a character,%<number>sβ for a string output with a width of at least<number>(any excess filled with spaces to the left),%ldβ for a number (use"lo"for displaying in octal notation and"lx"for hexadecimal notation).%<number>ldβ for a number output with a width of at least<number>(any excess filled with spaces to the left). Use"lo"for displaying in octal notation and"lx"for hexadecimal notation.
π EXAMPLES π
report-error "Too many input parameters for %s, encountered total of [%ld]", "customer", num_count
π§ SEE ALSO π§
- Error handling
db-errorerror-codeerror-handlingreport-error- See all documentation
lowkey reminder bestie: <format> is a literal, variables go in order, and mismatched types or mystery placeholders mean your program just gives up. not a drill. π
version $VERSION π dated $DATE π and that's the whole GOLF(2gg) page, mwah π go forth and report those fatal errors with main character energy β¨π«Ά
π¦ 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