# HImErrorHandler

## Functions

| `HImErrorHandler`
| `~HImErrorHandler`
void | `SetBlockByDefault`
void | `RegisterCallbacks`
void | `Block`
void | `Pass`
bool | `BlockByDefault`
void | `CallbackEntryPoint`

## Detailed Description

class HImErrorHandler

  The HImErrorHandler class implements a set of rules for when info/warnings/errors should be passed to the user.

  The HImErrorHandler allows for a more sophisticated scheme of prompting the user when necessary. For most warnings and errors, HOOPS does not retain the information that the user has already seen that message or one like it. The result is that the error messages can be duplicated to the point of making an application unusable. The alternative is to turn info/warnings/errors off (see #HC_Define_System_Options), but that is too broad a brush as it can cause potentially serious problems to be missed.

  In addition to the information string that the user sees, HOOPS error messages are identified by 3 integers: category, specific, and severity. The default behavior is for the HImErrorHandler to pass each combination of 3 integers exactly once during the execution of the application. Memory of what errors have already been given is kept in a linked list so that duplicates can be rejected. Additionally, Pass() can be used to specify that a certain error message always be passed; and Block() can be used to block even the first instance of a message. Both Pass() and Block() take the 3 identifying integers that describe an error, ‘-1’ is a special value interpreted as a wild card that matches anything. For example, Pass( HEC_CALLBACK, -1, -1 ) would always pass any callback related bugs. Info/warnings/errors matched by both Block() and Pass() will be passed.

  The most common usage is expected to be to simply register it with default settings just to avoid duplicates.

  Public Functions

  HImErrorHandler(bool BlockByDefault = false)

    Constructor an HImErrorHandler object.

    Parameters

      BlockByDefault – Pass true if you want to block all error messages by default if they haven’t been identified as blocked or passed.

  ~HImErrorHandler()
  inline void SetBlockByDefault(bool bbd)

    This method sets the behavior of the all errors not otherwise specified.

    Parameters

      bbd – Pass true to block by default or false to pass by default.

  Public Static Functions

  static void RegisterCallbacks()

    This method gives HOOPS pointers to the functions want to intercept. This function should be called just once, at the beginning of execution.

  static void Block(int cat, int spec, int sev)

    This method specifies the errors to always block. This includes errors that we may not have even seen before.

    Parameters

      - cat – The category number.

      - spec – The specific number.

      - sev – The severity number.

  static void Pass(int cat, int spec, int sev)

    This method specifies the errors to pass on. This includes errors that we may not have seen before.

    Parameters

      - cat – The category number.

      - spec – The specific number.

      - sev – The severity number.

  static inline bool BlockByDefault()
    Returns

      True if error messages are block by default unless specified otherwise or false if they are passed.

  static void CallbackEntryPoint(int category, int specific, int severity, int msgc, char *msgv[], int stackc, char *stackv[])

    This is the callback that is registered with HOOPS and handles the passing and blocking of errors. It must be static to be registered as a callback.