Skip to content

Commit

Permalink
Better Error Message for exportJSON type (#4556)
Browse files Browse the repository at this point in the history
  • Loading branch information
howlowck authored May 28, 2023
1 parent c0a59bc commit a82b754
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/lexical/src/LexicalEditorState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function exportNodeToJSON<SerializedNode>(node: LexicalNode): SerializedNode {
if (serializedNode.type !== nodeClass.getType()) {
invariant(
false,
'LexicalNode: Node %s does not implement .exportJSON().',
'LexicalNode: Node %s does not match the serialized type. Check if .exportJSON() is implemented and it is returning the correct type.',
nodeClass.name,
);
}
Expand Down
8 changes: 7 additions & 1 deletion scripts/error-codes/codes.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,11 @@
"122": "Expected nextRowNode not to be null",
"123": "Expected GridNode childAtIndex(%s) to be RowNode",
"124": "Unexpected empty cell",
"125": "Expected row next sibling to be a row"
"125": "Expected row next sibling to be a row",
"126": "TabNode does not support setTextContent",
"127": "TabNode does not support setDetail",
"128": "TabNode does not support setMode",
"129": "Expected parentElement of Text not to be null",
"130": "LexicalNode: Node %s does not match the serialized type. Check if .exportJSON() is implemented and it is returning the correct type.",
"131": "Expected to find LexicalNode from Table Cell DOMNode"
}

2 comments on commit a82b754

@vercel
Copy link

@vercel vercel bot commented on a82b754 May 28, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

lexical – ./packages/lexical-website

lexical.dev
lexicaljs.org
lexical-fbopensource.vercel.app
lexicaljs.com
www.lexical.dev
lexical-git-main-fbopensource.vercel.app

@vercel
Copy link

@vercel vercel bot commented on a82b754 May 28, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

lexical-playground – ./packages/lexical-playground

lexical-playground.vercel.app
lexical-playground-fbopensource.vercel.app
playground.lexical.dev
lexical-playground-git-main-fbopensource.vercel.app

Please sign in to comment.