次の方法で共有


interface ICoreWebView2ScriptException

Note

This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.

interface ICoreWebView2ScriptException
  : public IUnknown

This interface represents a JavaScript exception.

Summary

Members Descriptions
get_ColumnNumber The column number of the source where the exception occurred.
get_LineNumber The line number of the source where the exception occurred.
get_Message The Message is the exception's message and potentially stack.
get_Name The Name is the exception's class name.
get_ToJson This will return all details of the exception as a JSON string.

If the CoreWebView2.ExecuteScriptWithResult result has Succeeded as false, you can use the result's Exception property to get the script exception.

Applies to

Product Introduced
WebView2 Win32 1.0.2277.86
WebView2 Win32 Prerelease

Members

get_ColumnNumber

The column number of the source where the exception occurred.

public HRESULT get_ColumnNumber(UINT32 * value)

In the JSON it is exceptionDetail.columnNumber. Note that this position starts at 0.

get_LineNumber

The line number of the source where the exception occurred.

public HRESULT get_LineNumber(UINT32 * value)

In the JSON it is exceptionDetail.lineNumber. Note that this position starts at 0.

get_Message

The Message is the exception's message and potentially stack.

public HRESULT get_Message(LPWSTR * value)

In the JSON it is exceptionDetail.exception.description. This is the empty string if the exception doesn't have a description. This can happen if the script throws a non-Error object such as throw "abc";.

get_Name

The Name is the exception's class name.

public HRESULT get_Name(LPWSTR * value)

In the JSON it is exceptionDetail.exception.className. This is the empty string if the exception doesn't have a class name. This can happen if the script throws a non-Error object such as throw "abc";

get_ToJson

This will return all details of the exception as a JSON string.

public HRESULT get_ToJson(LPWSTR * value)

In the case that script has thrown a non-Error object such as throw "abc"; or any other non-Error object, you can get object specific properties.