Overview
C API (Component Interface)
struct EventErrorMessage { UINT32 flags; Symbol error; const char* msg; };

Attach an error message to the passed symbol. A new symbol is returned that has the error message attached. You can call the function as many times as required. Call this to add additional information (even a primary error message) to an error code before returning it to the framework from the Event Handler function. flags should be zero or F_TRACE.

Contract Wrappers

1199
berr

Fields

UINT32 flags IN
See below.
Symbol error IN
An error code (initially, the base error code, such as E_USER; on subsequent calls, the return code from this function).
const char* msg IN
The message to attach to the error.

Return Values

See also General Interface Return Values.

Notes
  • There is no need to check the return value before returning it to the framework, however, since only error codes can be returned from this function, whether it succeeds or not.
  • The new symbol representing the error with the message attached. The old symbol can be discarded.

Flags

F_TRACE
Associated message should be added as a trace message rather than an error message.
F_DEBUGTRACE
Associated message should be added as a debug-level trace message rather than an error message (these are hidden unless the user explicitly asks for them using the --maxerr Command Line switch).

Example

Taken from std/data/numeric.

C++ Source Code (against 1199)
try { ... } catch(std::exception e) { EventErrorMessage data; data.flags = 0; data.error = E_STD; data.msg = e.what(); EngineEvent event; event.hCaller = hComponent; event.flags = 0; event.type = ENGINE_EVENT_ERROR_MESSAGE; event.data = &data; data.error = brahms_engineEvent(&event); string name = "<unknown>"; if (componentData) name = componentData->name; string ss = ("whilst allocating memory for log of data object \"" + name + "\""); data.msg = ss.c_str(); data.flags = F_TRACE; throw brahms_engineEvent(&event); }