GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ’– 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-error
  • error-code
  • error-handling
  • report-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