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
When this makes it into browsers/node.js/platforms, there will be a new error type called SuppressedError which wraps any exception thrown and also any exception thrown during resource disposal.
Reporting SuppressedError directly to Sentry will likely be not that useful so the error(s) should be pulled out.
classSuppressedErrorextendsError{/** * Wraps an error that suppresses another error, and the error that was suppressed. * @param {*} error The error that resulted in a suppression. * @param {*} suppressed The error that was suppressed. * @param {string} message The message for the error. * @param {{ cause?: * }} [options] Options for the error. */constructor(error,suppressed,message,options);/** * The name of the error (i.e., `"SuppressedError"`). * @type {string} */name="SuppressedError";/** * The error that resulted in a suppression. * @type {*} */error;/** * The error that was suppressed. * @type {*} */suppressed;/** * The message for the error. * @type {*} */message;}
The TypeScript introduction gives a good example of how these properties are populated:
classErrorAextendsError{name="ErrorA";}classErrorBextendsError{name="ErrorB";}functionthrowy(id: string){return{[Symbol.dispose](){thrownewErrorA(`Error from ${id}`);}};}functionfunc(){usinga=throwy("a");thrownewErrorB("oops!")}try{func();}catch(e: any){console.log(e.name);// SuppressedErrorconsole.log(e.message);// An error was suppressed during disposal.console.log(e.error.name);// ErrorAconsole.log(e.error.message);// Error from aconsole.log(e.suppressed.name);// ErrorBconsole.log(e.suppressed.message);// oops!}
The text was updated successfully, but these errors were encountered:
Problem Statement
Explicit Resource Management has reached TC39 stage 3:
https://github.com/tc39/proposal-explicit-resource-management
Support has been added to TypeScript 5.2 beta:
https://devblogs.microsoft.com/typescript/announcing-typescript-5-2-beta/#using-declarations-and-explicit-resource-management
When this makes it into browsers/node.js/platforms, there will be a new error type called
SuppressedError
which wraps any exception thrown and also any exception thrown during resource disposal.Reporting
SuppressedError
directly to Sentry will likely be not that useful so the error(s) should be pulled out.The TypeScript introduction gives a good example of how these properties are populated:
The text was updated successfully, but these errors were encountered: