-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Description
Currently I understand that failures in resource cleanup will be thrown as an AggregateError, which may or may not have a cause property depending on whether or not the block which uses the resources errored.
I would like to suggest that there be a ResourceDisposalError or some new type of error, because developers will sometimes want to handle cleanup errors. It may be that I use a particular resource for which I know it is possible for disposal to fail, and I know that I don't care if it does. If so the current spec forces me to write:
try {
await criticalActionUsingResources()
} catch(e) {
// Did the critical action complete? Filter out disposal errors for separate handling
if (e instanceof AggregateError) {
// But I don't know if this is a resource cleanup error!
// Maybe it's a failed Promise.all
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels