Skip to content

Fix: Playground errors when serializing logs#3168

Closed
lukaw3d wants to merge 1 commit intomicrosoft:v2from
lukaw3d:logs-dont-crash
Closed

Fix: Playground errors when serializing logs#3168
lukaw3d wants to merge 1 commit intomicrosoft:v2from
lukaw3d:logs-dont-crash

Conversation

@lukaw3d
Copy link
Copy Markdown
Contributor

@lukaw3d lukaw3d commented Jun 28, 2024

Related to #3169

Errors thrown in Playground's output serialization should be different than user code errors.

Before:
https://www.typescriptlang.org/play/?target=7#code/PTAEAEBcEMCcHMCmkBcoCiBlATABjwFADGA9gHYDOJANogHTUnwAUA3qNGgIw+9-8DBQ4ULKgAvgEoCQA

  • // @target: ES2020
    console.log({ a: 11111111111111111111111111111111111111111111111111111n })
  • Click "Run"

  • [ERR]: "Executed JavaScript Failed:"
    [ERR]: Do not know how to serialize a BigInt

    thrown by

    JSON.stringify(arg, (_, value) => (value === undefined ? "__undefined__" : value), 2).replace(

After:

  • [LOG]: Failed to serialize log

For comparison, user code error:

  • // @target: ES2020
    JSON.stringify({ a: 11111111111111111111111111111111111111111111111111111n })
  • [ERR]: "Executed JavaScript Failed:"
    [ERR]: Do not know how to serialize a BigInt

@lukaw3d
Copy link
Copy Markdown
Contributor Author

lukaw3d commented Jun 28, 2024

@microsoft-github-policy-service agree

@lukaw3d lukaw3d closed this Aug 21, 2025
@lukaw3d lukaw3d deleted the logs-dont-crash branch August 21, 2025 11:24
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.

1 participant