GetExceptionCode

GetExceptionCode retrieves a code that identifies the type of exception that occurred. The function can be called only from within the filter expression or exception-handler block of a try-except exception handler.

Syntax

Copy
DWORD GetExceptionCode(VOID);

Parameters

This function has no parameters.

Return Value

The type of exception.

The following list shows the exception codes likely to occur due to common programming errors. For more information, see wRTOS Exception Handling.

Remarks

GetExceptionCode can be called only from within the filter expression or exception-handler block of a try-except statement. If an exception occurs during the try block's execution, the filter expression is evaluated, and it determines whether the except block is executed. The following example shows the structure of a try-except statement.

Copy
try {
/* try block */
}
except (filter-expression) {
/* exception handler block */
}

 

The filter expression can invoke a filter function. The filter function cannot call GetExceptionCode. However, the return value of GetExceptionCode can be passed as a parameter to a filter function. The return value of the GetExceptionInformation function can also be passed as a parameter to a filter function. GetExceptionInformation returns a pointer to a structure that includes the exception-code information. In the case of nested try-except statements, each statement's filter expression is evaluated until one is evaluated as EXCEPTION_EXECUTE_HANDLER or EXCEPTION_CONTINUE_EXECUTION. Each filter expression can invoke GetExceptionCode to get the exception code. The exception code returned is the code generated by a hardware exception, or the code specified in the RaiseException function for a software-generated exception.

Requirements

Minimum supported version Header

wRTOS 1.0 SDK

windows.h

See Also: