SOERROR(3iv)

✨ SoError β€” error handling base class ✨

okay bestie, welcome to the <pink>SoError(3IV)</pink> glow-up πŸ’– this is the manual page for the error handling base class, and yes we are going to read the whole thing together, no skimming, no scrolling past the boring bits, because every single flag and fact is staying right here 🫢


🌸 NAME 🌸

SoError β€” error handling base class πŸ’…


πŸ¦‹ INHERITS FROM πŸ¦‹

SoError

not me pointing out that the page says it inherits from itself πŸ™ˆ we do not make the rules, we just report them, periodt.

🌈 SYNOPSIS 🌈

#include <Inventor/errors/SoError.h>

typedef void        SoErrorCB(const SoError *error, void *data)

Methods from class SoError:

static void         setHandlerCallback(SoErrorCB *cb, void *data)
static SoErrorCB *  getHandlerCallback()
static void *       getHandlerData()
const SbString &    getDebugString() const
static SoType       getClassTypeId()
virtual SoType      getTypeId() const
SbBool              isOfType(SoType type) const

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so. SoError is the base class for all error classes, and those classes are the ones that handle error handling for applications. there are literally two facets to errors: posting and handling ✨

an error gets posted when some bad condition occurs 😭 and posting is done primarily by the Inventor library itself, but extenders can post their own errors too, slay. posting an error creates an instance of the appropriate error class (or subclass) and then passes it to the active error handler. the default handler just prints an appropriate message to stderr β€” that's it, that's the whole vibe. applications can override this behavior by supplying a different handler, which you do by specifying a callback function πŸ’…

every subclass of SoError supports the setHandlerCallback() method, and that's the one you use to set the callback function that handles errors. here's the tea though: the callback function for a specific error class is always used in preference to that of any base classes when handling errors 🫢

and now the important warning bestie, listen up: the error instance passed to a callback is deleted immediately after the callback is called πŸ’€ so if your application wants to save information from that instance, it has to copy it out first. no holding onto it. it's giving "blink and you'll miss it."

each error class contains a run-time class type id (SoType) that can be used to determine the type of an instance ✨ the base class defines a character string that represents a detailed error message that is printed by the default handler. and all handlers are called by the SoError::handleError() method πŸ‘‘ so when you're debugging, you can set a breakpoint on this method to stop right before an error is handled β€” that's your main character debugging moment, iykyk.


πŸ’– METHODS πŸ’–

  • static void setHandlerCallback(SoErrorCB *cb, void *data) β€” sets the handler callback for the SoError class. πŸŽ€
  • static SoErrorCB * getHandlerCallback() β€” returns the handler callback for the SoError class. πŸŽ€
  • static void * getHandlerData() β€” returns the handler data for the SoError class. πŸŽ€
  • const SbString & getDebugString() const β€” returns the debug string containing full error information from the instance. like, the whole lore. πŸ“–
  • static SoType getClassTypeId() β€” returns the type identifier for the SoError class. ⭐
  • virtual SoType getTypeId() const β€” returns the type identifier for the error instance. ⭐
  • SbBool isOfType(SoType type) const β€” returns TRUE if the instance is of the given type or is derived from it. πŸ’…

πŸŽ€ SEE ALSO πŸŽ€

SoDebugError, SoMemoryError, SoReadError β€” go read those next bestie, they're the whole friend group 🫢


and that's the page!! 🌸 this was the SoError(3IV) manual, footer and all, so consider yourself fully caught up, no cap πŸ’– bye bestie, go handle those errors responsibly βœ¨πŸ¦‹πŸ‘‘