-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exposing a new JSRT method to get additional information about exceptions #2936
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,6 +164,39 @@ JsGetModuleHostInfo( | |
_Outptr_result_maybenull_ void** hostInfo); | ||
|
||
#ifdef CHAKRACOREBUILD_ | ||
/// <summary> | ||
/// 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. | ||
/// </summary> | ||
/// <remarks> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you lay out the returned There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
/// <para> | ||
/// If the runtime of the current context is not in an exception state, this API will return | ||
/// <c>JsErrorInvalidArgument</c>. 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 | ||
/// <c>JsEnableRuntimeExecution</c>). | ||
/// </para> | ||
/// <para> | ||
/// The metadata value is a javascript object with the following properties: <c>exception</c>, the | ||
/// thrown exception object; <c>line</c>, the 0 indexed line number where the exception was thrown; | ||
/// <c>column</c>, the 0 indexed column number where the exception was thrown; <c>length</c>, the | ||
/// source-length of the cause of the exception; <c>source</c>, a string containing the line of | ||
/// source code where the exception was thrown; and <c>url</c>, a string containing the name of | ||
/// the script file containing the code that threw the exception. | ||
/// </para> | ||
/// <para> | ||
/// Requires an active script context. | ||
/// </para> | ||
/// </remarks> | ||
/// <param name="metadata">The exception metadata for the runtime of the current context.</param> | ||
/// <returns> | ||
/// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise. | ||
/// </returns> | ||
CHAKRA_API | ||
JsGetAndClearExceptionWithMetadata( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@liminzhu Should this be in ChakraCommon.h instead of core only? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the moment this is still experimental and not yet officially supported, which is why I put it in |
||
_Out_ JsValueRef *metadata); | ||
|
||
/// <summary> | ||
/// Called by the runtime to load the source code of the serialized script. | ||
/// </summary> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,4 +118,5 @@ | |
JsCreatePromise | ||
JsCreateWeakReference | ||
JsGetWeakReferenceValue | ||
JsGetAndClearExceptionWithMetadata | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to verify this API in the case where there is no exception thrown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, which required some fixes in the JSRT functions.