Skip to content

Make SuppressedError and AggregateError serializable #11425

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anonrig
Copy link

@anonrig anonrig commented Jul 2, 2025

(See WHATWG Working Mode: Changes for more details.)


/infrastructure.html ( diff )
/structured-data.html ( diff )

Copy link

@legendecas legendecas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might also be worth to serialize aggregateError.erros and suppressedError.suppressed.

@anonrig
Copy link
Author

anonrig commented Jul 2, 2025

cc @annevk @domenic would you mind reviewing this?

It might also be worth to serialize aggregateError.erros and suppressedError.suppressed.

@legendecas The spec already mentions them indirectly:

<li><p>Any interesting accompanying data attached to <var>serialized</var> should be
     deserialized and attached to <var>value</var>.</p></li>

@zloirock
Copy link

zloirock commented Jul 2, 2025

.cause also should be serialized.

@zloirock
Copy link

zloirock commented Jul 2, 2025

#5749

@anonrig
Copy link
Author

anonrig commented Jul 2, 2025

@zloirock No need to mention them one by one due to:

<li><p>Any interesting accompanying data attached to <var>serialized</var> should be
     deserialized and attached to <var>value</var>.</p></li>

@zloirock
Copy link

zloirock commented Jul 2, 2025

@anonrig this is a rather vague formulation. For example, Safari still does not serialize it, and in the mentioned above PR it's handled directly.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've unchecked the "at least two implementers are interested" checkbox, as for the WHATWG process, the implementers need to be browser engines.

Note that the vague clause you cite is not sufficient to serialize these properties. It only applies to data that has no specification:

User agents should attach a serialized representation of any interesting accompanying data which are not yet specified, notably the stack property, to serialized.

and the properties you mention have specifications, so are not included here.

You'd need a fully-detailed specification for how these are serialized, which we can write detailed web platform tests against, for this to be acceptable.

@anonrig
Copy link
Author

anonrig commented Jul 3, 2025

@domenic thanks for the review. This is my first time contributing to html spec so any help/guidance is extremely helpful. what are the next steps for moving this forward? I can update the pull-request without any problem.

@domenic
Copy link
Member

domenic commented Jul 3, 2025

Thanks for your contribution!

Per my last message, there are two major blockers:

  • Creating a fully-detailed specification for serializing and deserializing that extra data. (And then updating the tests to test the edge cases of that. E.g., what happens if someone re-defines suppressed as enumerable, or deletes it from the instance, or deletes it from the instance but re-defines it on Object.prototype?)

  • Getting implementer interest from 2+ browser engines.

FWIW, you can see an earlier failed attempt at this in #5749. We were unable to get implementer interest, sadly, as only Gecko seems to be devoting any engineering resources to structured cloning.

I'll try adding the agenda+ label to attract interest from others.

@domenic domenic added the agenda+ To be discussed at a triage meeting label Jul 3, 2025
@annevk
Copy link
Member

annevk commented Jul 3, 2025

WebKit is supportive of doing this.

@evilpie
Copy link
Member

evilpie commented Jul 3, 2025

SuppressedError is part of the Explicit Resource Management proposal and currently at stage 3.

I personally don't think there is much point in adding these without also specifying that their properties like errors of AggregateError are serialized.

@anonrig
Copy link
Author

anonrig commented Jul 3, 2025

I personally don't think there is much point in adding these without also specifying that their properties like errors of AggregateError are serialized.

I'll update the PR and add those fields.

@zloirock
Copy link

zloirock commented Jul 3, 2025

@evilpie in the previous TC39 meeting, this proposal received stage 4.

@smaug---- smaug---- removed the agenda+ To be discussed at a triage meeting label Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy