Skip to content

[lexical-clipboard] Bug Fix: Log exceptions in clipboard paste handler#7942

Merged
etrepum merged 4 commits intofacebook:mainfrom
niikkhilsharma:fix/paste-exception-handling
Oct 23, 2025
Merged

[lexical-clipboard] Bug Fix: Log exceptions in clipboard paste handler#7942
etrepum merged 4 commits intofacebook:mainfrom
niikkhilsharma:fix/paste-exception-handling

Conversation

@niikkhilsharma
Copy link
Copy Markdown
Contributor

@niikkhilsharma niikkhilsharma commented Oct 22, 2025

This PR fixes issue #7940 where exceptions thrown during HTML paste operations were silently swallowed, making it impossible for developers to debug import handlers.

Current behavior: When an error occurs in custom HTML import handlers (e.g., html.import.span), the exception is caught in clipboard.ts but never displayed or logged. Developers have no visibility into why paste operations fail or behave unexpectedly.

Changes made: Modified the error handling in @lexical/clipboard to properly log exceptions during HTML paste operations. The exceptions are now surfaced to the console with full stack traces, allowing developers to identify and fix issues in their custom import handlers.

The fix ensures that while paste operations remain stable in production, developers get the diagnostic information they need during development and debugging.

Closes #7940

Test plan

After

image

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 22, 2025
@vercel
Copy link
Copy Markdown

vercel bot commented Oct 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
lexical Ready Ready Preview Comment Oct 23, 2025 2:18pm
lexical-playground Ready Ready Preview Comment Oct 23, 2025 2:18pm

Copy link
Copy Markdown
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

The error handling elsewhere uses console.error rather than console.log

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Oct 23, 2025
@etrepum etrepum added this pull request to the merge queue Oct 23, 2025
Merged via the queue into facebook:main with commit 9978ef8 Oct 23, 2025
39 checks passed
@etrepum etrepum changed the title Fix: Log exceptions in clipboard paste handler (fixes #7940) [lexical-clipboard] Bug Fix: Log exceptions in clipboard paste handler Oct 27, 2025
This was referenced Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Exception is swallowed when pasting into editor

2 participants