Skip to content

JsGetAndClearExceptionWithMetadata

Limin Zhu edited this page May 16, 2017 · 1 revision

Returns metadata relating to the exception that caused the runtime of the current context to be in the exception state and resets the exception state for that runtime. The metadata includes a reference to the exception itself.

Syntax

CHAKRA_API
    JsGetAndClearExceptionWithMetadata(
        _Out_ JsValueRef *metadata);

Parameters

  • metadata: The exception metadata for the runtime of the current context.

Return Value

The code JsNoError if the operation succeeded, a failure code otherwise.

Remarks

This API is experimental and may have breaking change later.

If the runtime of the current context is not in an exception state, this API will return JsErrorInvalidArgument. If the runtime is disabled, this will return an exception indicating that the script was terminated, but it will not clear the exception (the exception will be cleared if the runtime is re-enabled using JsEnableRuntimeExecution).

The metadata value is a javascript object with the following properties: exception, the thrown exception object; line, the 0 indexed line number where the exception was thrown; column, the 0 indexed column number where the exception was thrown; length, the source-length of the cause of the exception; source, a string containing the line of source code where the exception was thrown; and url, a string containing the name of the script file containing the code that threw the exception.

Requires an active script context.

Clone this wiki locally