| 1 |
NAME SoError "SoErr" "" { error handling base class } |
| 2 |
|
| 3 |
INCLUDE errors/SoError.h |
| 4 |
|
| 5 |
DESC { \cSoError\. is the base class for all error classes, |
| 6 |
which provide error handling for applications. |
| 7 |
There are two facets to errors: posting and handling. An error is |
| 8 |
posted when some bad condition occurs. Posting is done primarily |
| 9 |
by the Inventor library itself, but extenders can post their own |
| 10 |
errors. Posting an error creates an instance of the appropriate |
| 11 |
error class (or subclass) and then passes it to the active error |
| 12 |
handler. The default handler just prints an appropriate message to |
| 13 |
stderr. Applications can override this behavior by supplying a |
| 14 |
different handler (by specifying a callback function). |
| 15 |
\p |
| 16 |
Each subclass of SoError supports the |
| 17 |
\+\msetHandlerCallback()\. method,\. |
| 18 |
\-\mSoErrSetHndlrCB()\. function,\. |
| 19 |
which is used to set the callback function to handle errors. |
| 20 |
The callback function for a specfic error class is always used in preference |
| 21 |
to that of any base classes when handling errors. |
| 22 |
The error instance passed to a callback is deleted immediately |
| 23 |
after the callback is called; an application that wishes to save |
| 24 |
information from the instance has to copy it out first. |
| 25 |
\p |
| 26 |
Each error class contains a run-time class type id (\cSoType\.) that |
| 27 |
can be used to determine the type of an instance. The base class |
| 28 |
defines a character string that represents a detailed error |
| 29 |
message that is printed by the default handler. |
| 30 |
\+All handlers are called by the \mSoError::handleError()\. method. When |
| 31 |
debugging, you can set a breakpoint on this method to stop right |
| 32 |
before an error is handled.\. |
| 33 |
} |
| 34 |
|
| 35 |
TYPEDEF void SoErrorCB "(const SoError *error, void *data)" |
| 36 |
|
| 37 |
METHOD "setHndlrCB" static void setHandlerCallback(SoErrorCB *cb, void *data) {} |
| 38 |
METHOD "getHndlrCB" static SoErrorCB * getHandlerCallback() {} |
| 39 |
METHOD "getHndlrData" static void * getHandlerData() { |
| 40 |
Sets/returns handler callback for \cSoError\. class. |
| 41 |
} |
| 42 |
|
| 43 |
METHOD "getDbgStr" const SbString & getDebugString() const { |
| 44 |
Returns debug string containing full error information from instance. |
| 45 |
} |
| 46 |
|
| 47 |
METHOD "" static SoType getClassTypeId() { |
| 48 |
Returns type identifier for SoError class. |
| 49 |
} |
| 50 |
|
| 51 |
METHOD "" virtual SoType getTypeId() const { |
| 52 |
Returns type identifier for error instance. |
| 53 |
} |
| 54 |
|
| 55 |
METHOD "" SbBool isOfType(SoType type) const { |
| 56 |
Returns TRUE if instance is of given type or is derived from it. |
| 57 |
} |
| 58 |
|
| 59 |
ALSO { |
| 60 |
SoDebugError, |
| 61 |
SoMemoryError, |
| 62 |
SoReadError |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
|