Contents

TwHanldeErrors (function)

void TwHandleErrors(TwErrorHandler errorHandler)

Description

By default, if an error occurs AntTweakBar prints a message to the standard error console output stream (stderr, cerr), and optionally to the output debug panel if your app is run from Visual Studio.

TwHanldeErrors allows you to change this behavior by defining your own error handler. This handle function will be called each time an error occurs (e.g. while parsing an improper def parameter).

Parameter

errorHandler

The function that will be called by AntTweakBar when an error occurs.

You should define this function like this:

void TW_CALL MyErrorHandler(const char *errorMessage)
{ 
    // do something, or nothing.
}

Example

#include <assert.h>
 
void TW_CALL BreakOnError(const char *errorMessage)
{ 
    assert(errorMessage==NULL); // show an assert message if an error occurred
}
 
// ...
 
TwHandleErrors(BreakOnError);

See also

TwGetLastError