GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ’– GOLF(2gg) πŸ’–

okay bestie, you found the error-code page β€” it's the Golf documentation all about error-handling, and honestly? it's giving "the receipts" energy. every time something goes wrong in Golf, this is where you find out why. ✨


🌸 NAME 🌸

error-code β€” Golf documentation (error-handling). yep that's the whole vibe. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so like. a lot of Golf statements hand you back a status with these GG_ERR_... error codes, and ngl they're descriptive to a point. they don't always get as granular as the operating system's errno variable, though β€” but don't panic, bestie, because you can pull the last known errno value from those statements with the errno clause in the get-req statement. πŸ’…

girl, listen. grab that value as soon as possible after the statement runs, because another statement might come along and overwrite it afterwards. it is not going to wait for you. 😭

here's the example, and it's lowkey iconic. a directory gets attempted-deleted via delete-file, which fails with GG_ERR_DELETE β€” but you can snag a way more specific code through errno. in this case it's 21, aka EISDIR, which literally means it cannot delete a directory with this statement:

delete-file "some_directory" status stc
if-true stc equal GG_ERR_DELETE
    get-req errno to e
    @Cannot delete file
    print-format "Error %ld\n", e
end-if

⚠️ important note ⚠️ with some GG_ERR_... codes, the errno clause in get-req may return 0. and what does that mean? it means the error was detected by Golf itself and not reported by the operating system. so 0 here isn't "no error", it's "this one's on Golf, not the OS". 🫢

you can also use the standard Linux constants β€” the ones defined in the C errno.h include file β€” to compare the error code you got with get-req. for instance, constants like EACCES or EEXIST. πŸ’–

and if you ever wanna know what a specific errno number or name actually means? just use the standard Linux utility errno. it'll tell you. main character utility behaviour, fr fr. πŸ‘‘


✨ SEE ALSO ✨

  • Error handling
  • db-error
  • error-code
  • error-handling
  • report-error
  • See all documentation

and that's the whole page, bestie!! πŸŽ€ this one's from $VERSION and it's dated $DATE β€” so go forth, catch those error codes, and slay. periodt. πŸ’œπŸŒˆ

πŸ“¦ where this page comes from