Skip to content

Graduate enhanced error serialization#6437

Merged
jasnell merged 1 commit intomainfrom
jasnell/graduate-enhanced-error-ser
Mar 27, 2026
Merged

Graduate enhanced error serialization#6437
jasnell merged 1 commit intomainfrom
jasnell/graduate-enhanced-error-ser

Conversation

@jasnell
Copy link
Copy Markdown
Collaborator

@jasnell jasnell commented Mar 27, 2026

No description provided.

@jasnell jasnell requested a review from danlapid March 27, 2026 00:05
@jasnell jasnell requested review from a team as code owners March 27, 2026 00:05
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 27, 2026

Now I understand the full picture. Let me analyze:

  1. compatibility-date.capnp change: $experimental -> $compatEnableDate("2026-04-21") — This graduates the enhanced_error_serialization flag from experimental to a standard compat flag with a future enable date of 2026-04-21. This is a standard graduation pattern.

  2. streams-test.wd-test: Adds "enhanced_error_serialization" to the explicit compatibility flags. Since the default test variant uses compat date 2000-01-01 (well before 2026-04-21), the flag must be explicitly listed for the test to use it. This is correct.

  3. streams-test.js: The ExampleError test case changes:

    • Old: expectError: 'Error: ExampleError: foo bar' with errorType: Error — Without enhanced error serialization, the custom error class isn't preserved through serialization; it becomes a plain Error wrapping the original string.
    • New: expectError: 'ExampleError: foo bar' with errorType removed — With enhanced error serialization, the custom name property is preserved, so String(e) gives 'ExampleError: foo bar' instead of 'Error: ExampleError: foo bar'.

The removal of errorType: Error makes sense because with enhanced error serialization, the error's name is preserved but the deserialized object may not literally be an ExampleError instance (since ExampleError is a custom class that can't be reconstructed). The instanceof Error check would still pass, but the test just doesn't assert a specific type anymore — which is fine since the String(e) comparison already validates the name.

This is a clean, minimal graduation of an experimental compat flag. The enable date is ~25 days in the future from the PR creation date, giving adequate lead time. The test adjustment correctly reflects the changed behavior when the flag is enabled.

LGTM

github run

@jasnell jasnell merged commit 0d830b1 into main Mar 27, 2026
25 of 28 checks passed
@jasnell jasnell deleted the jasnell/graduate-enhanced-error-ser branch March 27, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants