You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The HTML spec defines a reportError function which takes a JS value (usually an exception object) and acts as if that value had been thrown, without actually stopping the execution of the current function and its callstack. This seems fairly useful in server-side environments.
Acting "as if the value had been thrown" in browsers includes firing an error event at the global, propagating up the chain of workers if called inside a dedicated worker, and eventually, if the error is not handled at any step along the way, logging the corresponding error message on the console.
However, specifying this for server-side runtimes would involve having to deal with the runtime's existing error handling mechanisms, which might be quite different to those in browsers. (See also #29)
The text was updated successfully, but these errors were encountered:
Note that patterns such as setTimeout(() => {throw err;}, 1) are used on Node.js code, so it's not like this API wouldn't find any use.
On that note, the "report an error" spec algorithm is used by a number of the APIs in the list, and we should probably mention that runtimes which claim to be WinterCG-compatible can override the behavior of this algorithm to exit instead.
The HTML spec defines a
reportError
function which takes a JS value (usually an exception object) and acts as if that value had been thrown, without actually stopping the execution of the current function and its callstack. This seems fairly useful in server-side environments.Acting "as if the value had been thrown" in browsers includes firing an
error
event at the global, propagating up the chain of workers if called inside a dedicated worker, and eventually, if the error is not handled at any step along the way, logging the corresponding error message on the console.However, specifying this for server-side runtimes would involve having to deal with the runtime's existing error handling mechanisms, which might be quite different to those in browsers. (See also #29)
The text was updated successfully, but these errors were encountered: