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
This was brought up by @waldemarhorwat in the July TC39 meeting. Java's try-with-resources block will suppress exceptions raised when disposing resources if already propagating an exception from the body.
However, there are two points that cause me concern about adopting this behavior:
This behavior would differ significantly from a regular try..finally statement.
Java has a way to retrieve these suppressed exceptions by calling the Throwable.getSuppressed() method on the exception thrown. ECMAScript does not have a reliable way to provide this as it is possible to throw a non-Error value.
Should we consider following Java's lead here and perform the same suppression?
The text was updated successfully, but these errors were encountered:
This was brought up by @waldemarhorwat in the July TC39 meeting. Java's
try
-with-resources block will suppress exceptions raised when disposing resources if already propagating an exception from the body.However, there are two points that cause me concern about adopting this behavior:
try..finally
statement.Throwable.getSuppressed()
method on the exception thrown. ECMAScript does not have a reliable way to provide this as it is possible to throw a non-Error
value.Should we consider following Java's lead here and perform the same suppression?
The text was updated successfully, but these errors were encountered: