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
SuppressedErrorbuilt-inErrorsubclass to represent an error that suppresses another error as a result of disposal.A
SuppressedErroris defined as:Such that, given the following:
The exception caught by
ewould have the following shape:This is due to the following execution flow:
ais tracked for disposalbis tracked for disposalError("c")is thrown, triggering disposalbis disposed, throwingError("b")and suppressingError("c"), producing aSuppressedError(Error("b"), Error("c")).ais disposed, throwingError("a")and suppressingSuppressedError(Error("b"), Error("c")).See #104 (comment) for additional context.
Supersedes #104
Fixes #74
Fixes #112