Skip to content

fix: include serialization error details#695

Open
KirtiRamchandani wants to merge 1 commit into
GoogleChromeLabs:mainfrom
KirtiRamchandani:fix/serialization-error-details
Open

fix: include serialization error details#695
KirtiRamchandani wants to merge 1 commit into
GoogleChromeLabs:mainfrom
KirtiRamchandani:fix/serialization-error-details

Conversation

@KirtiRamchandani

@KirtiRamchandani KirtiRamchandani commented May 25, 2026

Copy link
Copy Markdown

Problem

When Comlink catches an error while serializing a return value, the caller only receives Unserializable return value. That hides the underlying serialization error message that usually explains what could not be cloned or serialized.

Root cause

The serialization fallback catch block discarded the caught error and always created the same generic TypeError.

Solution

Build the fallback TypeError message from the caught serialization error when it has details, while keeping the existing generic prefix. Added a same-window regression test with a deterministic transfer handler that throws during serialization.

Tests

  • npm run build
  • npm run test:types
  • CHROME_ONLY=1 npm run test:unit
  • npm run test:node
  • npm exec --yes prettier@2.8.3 -- --check src/comlink.ts tests/same_window.comlink.test.js
  • git diff --check

Fixes #679.

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.

caught error information lost

1 participant