Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoError Class Reference

Error handling base class. More...

#include <Inventor/errors/SoError.h>

+ Inheritance diagram for SoError:

Public Types

typedef void SoErrorCB(const SoError *error, void *data)
 Error handling callbacks are of this type.
 

Public Member Functions

const SbStringgetDebugString () const
 Returns debug string containing full error information from instance.
 
virtual SoType getTypeId () const
 Returns type identifier for error instance.
 
virtual ~SoError ()
 Destructor.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static void setHandlerCallback (SoErrorCB *cb, void *data)
 Sets handler callback for SoError class.
 
static SoErrorCBgetHandlerCallback ()
 Returns handler callback for SoError class.
 
static void * getHandlerData ()
 Returns handler data for SoError class.
 
static SoType getClassTypeId ()
 Returns type identifier for SoError class.
 
static SoPRINTF void post (const char *formatString ...)
 Posts an error.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Detailed Description

Error handling base class.

SoError is the base class for all error classes, which provide error handling for applications. There are two facets to errors: posting and handling. An error is posted when some bad condition occurs. Posting is done primarily by the Open Inventor library itself, but extenders can post their own errors. 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. Applications can override this behavior by supplying a different handler (by specifying a callback ). Some implementations of the Open Inventor window system specific layer provide alternate ways to display an error message, for example SoConsole.

Each subclass of SoError supports the setHandlerCallback() method, which is used to set the callback to handle errors. The callback for a specific error class is always used in preference to that of any base classes when handling errors. The error instance passed to a callback is deleted immediately after the callback is called; an application that wishes to save information from the instance has to copy it out first.

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. All handlers are called by the SoError::handleError() method. When debugging, you can set a breakpoint on this method to stop right before an error is handled.

SEE ALSO

SoDebugError, SoMemoryError, SoReadError, SoGLError

Definition at line 109 of file SoError.h.

Member Typedef Documentation

◆ SoErrorCB

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

Error handling callbacks are of this type.

Definition at line 69 of file SoError.h.

Constructor & Destructor Documentation

◆ ~SoError()

virtual SoError::~SoError ( )
inlinevirtual

Destructor.

Definition at line 145 of file SoError.h.

Member Function Documentation

◆ getClassTypeId()

static SoType SoError::getClassTypeId ( )
static

Returns type identifier for SoError class.

◆ getDebugString()

const SbString & SoError::getDebugString ( ) const
inline

Returns debug string containing full error information from instance.

Definition at line 130 of file SoError.h.

◆ getHandlerCallback()

static SoErrorCB * SoError::getHandlerCallback ( )
static

Returns handler callback for SoError class.

◆ getHandlerData()

static void * SoError::getHandlerData ( )
static

Returns handler data for SoError class.

◆ getTypeId()

virtual SoType SoError::getTypeId ( ) const
virtual

Returns type identifier for error instance.

Implements SoTypedObject.

Reimplemented in SoDebugError, SoErrorStack, SoGLError, SoMemoryError, and SoReadError.

◆ post()

static SoPRINTF void SoError::post ( const char *  formatString ...)
static

Posts an error.

The debugString will be created from the given arguments, which are in printf() format

◆ setHandlerCallback()

static void SoError::setHandlerCallback ( SoErrorCB cb,
void *  data 
)
static

Sets handler callback for SoError class.


The documentation for this class was generated from the following file: