# SoDebugError Class Reference
[Error handling]

`#include <Inventor/errors/SoDebugError.h>`

Inheritance diagram for SoDebugError:

List of all members.

## Detailed Description

The SoDebugError class is the internal debugging message passing mechanism.

This class basically serves two purposes:

1) It is the message interface through which error and warning conditions are passed to the programmer which is using the Coin library API for building applications. These messages are generated when API methods are used in an incorrect manner, or if actions on the library has caused it to enter an inconsistent state. Coin programmers should then quickly be able to trace down errors in their application code.

For this service to be available, the Coin library must be compiled with debugging information. For release builds, most of this "programmer's safety net" is removed to gain maximum speed and to use minimum space (build the smallest possible library).

2) Coin application programmers can call the SoDebugError methods within their own code as a convenient way of debugging application code, replacing the usual cascades of fprintf() calls.

Coin supports an environment variable to set conditional breakpoints. The COIN_DEBUG_BREAK environment variable can be set to any number of functions in the form of a list separated by commas or spaces. The functionnames must be given as "classname::functioname" (ie without return type, parenthesis or argument types or names). If a debug message is posted from one of those functions, your program will be stopped (using assert(0)).

This can be useful if you want to get core-dumps or enter a debugger whenever for instance a warning or an error is posted from some function (e.g. "SbVec3f::normalize"). This feature is only enabled in the debug version of Coin.

## Public Types

enum | Severity { ERROR, WARNING, INFO }

## Public Member Functions

virtual SoType | getTypeId (void) const
SoDebugError::Severity | getSeverity (void) const

## Static Public Member Functions

void | setHandlerCallback (SoErrorCB *const function, void *const data)
SoErrorCB * | getHandlerCallback (void)
void * | getHandlerData (void)
SoType | getClassTypeId (void)
void | post (const char *const source, const char *const format,...)
void | postWarning (const char *const source, const char *const format,...)
void | postInfo (const char *const source, const char *const format,...)
void | initClass (void)

## Protected Member Functions

virtual SoErrorCB * | getHandler (void *&data) const

## Member Enumeration Documentation

enum SoDebugError::Severity

| Specifies the available severity levels of the debug messages.

## Member Function Documentation

void SoDebugError::setHandlerCallback | ( | SoErrorCB *const | function,
|  | void *const | data
| ) | `[static]`

This method sets the error handler callback for messages posted via this class.

Note that this will not override the error/debug message handler for subclasses, these will have to be overrided by calling the subclass' setHandlerCallback() method.

See also:
  defaultHandlerCB()

Reimplemented from SoError.

SoErrorCB * SoDebugError::getHandlerCallback | ( | void |  | ) | `[static]`

| Returns the error handler callback for messages posted via this class. Reimplemented from SoError.

void * SoDebugError::getHandlerData | ( | void |  | ) | `[static]`

| This method returns the pointer used for passing data back to the callback handler method. Reimplemented from SoError.

SoType SoDebugError::getClassTypeId | ( | void |  | ) | `[static]`

This static method returns the SoType for this class.

See also:
  getTypeId()

Reimplemented from SoError.

SoType SoDebugError::getTypeId | ( | void |  | ) | const`[virtual]`

This method returns the SoType of a particular object instance.

See also:
  getClassTypeId()

Reimplemented from SoError.

SoDebugError::Severity SoDebugError::getSeverity | ( | void |  | ) | const

Returns severity level of current message.

You can use this to filter out debug messages and only let warnings and/or errors pass through to the end-user if you have set your own handler callback.

See also:
  setHandlerCallback()

void SoDebugError::post | ( | const char *const | source,
|  | const char *const | format,
|  | ... |
| ) | `[static]`

| This method posts a message with severity level "ERROR". source should be the name of the calling function.

void SoDebugError::postWarning | ( | const char *const | source,
|  | const char *const | format,
|  | ... |
| ) | `[static]`

| This method posts a message with severity level "WARNING". source should be the name of the calling function.

void SoDebugError::postInfo | ( | const char *const | source,
|  | const char *const | format,
|  | ... |
| ) | `[static]`

| This method posts a message with severity level "INFO". source should be the name of the calling function.

void SoDebugError::initClass | ( | void |  | ) | `[static]`

| This method takes care of initializing all static data for the class. Reimplemented from SoError.

SoErrorCB * SoDebugError::getHandler | ( | void *& | data | ) | const`[protected, virtual]`

| This is just a convenience wrapper around the getHandlerCallback() and getHandlerData() methods. Reimplemented from SoError.

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

- SoDebugError.h
- SoDebugError.cpp