-
Notifications
You must be signed in to change notification settings - Fork 30
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
Adds SuppressedError
#117
Adds SuppressedError
#117
Conversation
A preview of this PR can be found at https://tc39.es/proposal-explicit-resource-management/pr/117. |
Why wouldn't |
I considered using |
@rbuckton trying to implement this, I remain very confused why a SuppressedError would have an Also, as specified, neither of the arguments are required for SuppressedError - i can do Was this discussed at the recent plenary? |
As I mentioned above,
That's a possibility. I left it in to remain consistent with other built-in
The presence or absence of
Yes, this was in the slides I presented prior to Stage 3 advancement. |
Its special meaning is "the cause of the error", which is precisely how this proposal describes the |
Additionally, |
The same could be said for
This is precisely why I do not believe we should use |
I wouldn't say the same for AggregateError - The reality is that |
Of all of these options, the only one I would consider is "do not InstallErrorCause in only this one kind of error". The intent |
I have use cases for a SuppressedError without a cause. |
In the spec, or elsewhere? If your use case is not to represent the relationship I described above, I'd suggest using a different |
Why? The name for it is "suppressed error" - that's what |
For what purpose would you throw a Making the |
It's already optional. |
The argument, maybe, by nature of the JS construct algorithm, but not the property that is installed on the object. |
Adds a new
SuppressedError
built-inError
subclass to represent an error that suppresses another error as a result of disposal.A
SuppressedError
is defined as:Such that, given the following:
The exception caught by
e
would have the following shape:This is due to the following execution flow:
a
is tracked for disposalb
is tracked for disposalError("c")
is thrown, triggering disposalb
is disposed, throwingError("b")
and suppressingError("c")
, producing aSuppressedError(Error("b"), Error("c"))
.a
is disposed, throwingError("a")
and suppressingSuppressedError(Error("b"), Error("c"))
.See #104 (comment) for additional context.
Supersedes #104
Fixes #74
Fixes #112