GLG Toolkit, C# Class Library  Version 4.6

This group contains methods for custom error handling. More...

Detailed Description

This group contains methods for custom error handling.

Functions

static void CatchGlobalErrors (bool catch_all, bool exit)
 Installs the GLG error handler as a global error handler for processing any uncaught exceptions in a GLG application. More...
 
static void Error (GlgErrorType error_type, String message, Exception exception, bool async_error=false)
 Display an error message using the GLG error handler. More...
 
static GlgErrorHandler SetErrorHandler (GlgErrorHandler new_handler)
 Replaces the GLG Toolkit error handler and returns the previous error handler. More...
 

Function Documentation

◆ CatchGlobalErrors()

static void CatchGlobalErrors ( bool  catch_all,
bool  exit 
)
static

Installs the GLG error handler as a global error handler for processing any uncaught exceptions in a GLG application.

This method may be invoked on application start-up to log exceptions and display a stack trace for application errors via the GLG error handler.

Parameters
catch_allIf true, all exceptions will be caught, otherwise only thread exceptions will be caught.
exitIf true, the application will exit after displaying an error message.

◆ Error()

static void Error ( GlgErrorType  error_type,
String  message,
Exception  exception,
bool  async_error = false 
)
static

Display an error message using the GLG error handler.

Invokes a currently installed error handler to generate an error message. See GlgErrorType for details on how different message types are handled by the default error handler.

Parameters
error_typeSpecifies an error type, may be one of the following:
messageThe message to be displayed.
exceptionAn optional exception that caused the error. If it is not null, it is used to extract additional information and an exact stack trace.
async_error(optional, can be omitted). By default, errors are reported using a modal dialog which can disrupt window event sequence. If this parameter is present and set to true, the error dialog is activated on the event thread using a timer to prevent problems when errors are reported while processing Windows events.

◆ SetErrorHandler()

static GlgErrorHandler SetErrorHandler ( GlgErrorHandler  new_handler)
static

Replaces the GLG Toolkit error handler and returns the previous error handler.

Parameters
new_handlerSpecifies a new error handler, supplied by the user, to be called on an error condition. This does not include internal errors of the GLG Toolkit, if any are detected: they are still reported using the default handler.
Returns
The previous error handler.

The GLG default error handler emits an audio beep and logs the error in the glg_error.log file.

See GlgErrorType for details on how different message types are handled by the default error handler.