vpGetError(3)

πŸ“¦ version 1.0c7, in fedora 43, fedora 44

πŸ’– vpGetError β€” retrieve error codes ✨

okay bestie, so this one lives in the Library Functions Manual (section 3, the library girlies) and it's literally the ✨vibe check✨ for your VolPack errors. Two lil functions, one big job: telling you what went wrong. 🫢


🌸 SYNOPSIS 🌸

#include <volpack.h>

vpResult
vpGetError(vpc)
    vpContext *vpc;

char *
vpGetErrorString(code)
    vpResult code;

πŸŽ€ ARGUMENTS πŸŽ€

  • vpc β€” your VolPack context, the one you got from vpCreateContext. it's giving main character energy, everything needs it πŸ’…
  • code β€” a VolPack error result code. just a code, bestie, but make it meaningful 🌈

πŸ’œ DESCRIPTION πŸ’œ

so these two routines are your whole error-handling situation. like, this is the group chat where your program finally tells you what happened. πŸ™ˆ

vpGetError returns the error code from the first function call that failed since the last time you called vpGetError. yes, the FIRST one β€” not the latest, not the messiest, the original. it's not me being dramatic, that's literally the spec. ✨

vpGetErrorString hands you a descriptive string that matches up with an error code, so you get actual words instead of cryptic numbers. iconic. and here's the slay part: that string lives in a global array, so you do not need to copy it off to separate memory. it's already home. πŸ πŸ’–


πŸ”₯ ERRORS πŸ”₯

  • vpGetError literally cannot fail. no cap. so if you get back anything that is not equal to VP_OK, that means some previous function call already flopped. πŸ‘€
  • vpGetErrorString returns NULL if code is invalid. so if you're getting NULL, bestie, check that code. πŸ’€
no guessing here β€” VP_OK is the good vibe, anything else means somebody upstream messed up.

πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie πŸ₯° β€” brought to you by VolPack, from the Library Functions Manual, vpGetError(3). go forth and actually check your error codes, periodt. πŸ’…βœ¨πŸ‘‘

πŸ“¦ where this page comes from