Skip to content

Commit

Permalink
print error message when example cannot be parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
deder-mw committed Dec 7, 2023
1 parent 42bccf5 commit 1eb2ca7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
24 changes: 22 additions & 2 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const LiveCodeEditor: FC<LiveCodeEditorProps> = (props) => {
try {
return extractDefaultExport(code);
} catch (error) {
return "<p>Example could not be parsed.</p>";
return `<p><em>Example could not be parsed:</em> ${String(error)}</p>`;
}
};

Expand Down
11 changes: 10 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8368,7 +8368,7 @@ __metadata:
languageName: node
linkType: hard

"acorn@npm:8.11.2":
"acorn@npm:8.11.2, acorn@npm:^8.0.0, acorn@npm:^8.11.2, acorn@npm:^8.4.1, acorn@npm:^8.7.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0":
version: 8.11.2
resolution: "acorn@npm:8.11.2"
bin:
Expand All @@ -8377,6 +8377,15 @@ __metadata:
languageName: node
linkType: hard

"acorn@npm:^7.4.1":
version: 7.4.1
resolution: "acorn@npm:7.4.1"
bin:
acorn: bin/acorn
checksum: bd0b2c2b0f334bbee48828ff897c12bd2eb5898d03bf556dcc8942022cec795ac5bb5b6b585e2de687db6231faf07e096b59a361231dd8c9344d5df5f7f0e526
languageName: node
linkType: hard

"acorn@patch:acorn@npm%3A8.11.2#~/.yarn/patches/acorn-npm-8.11.2-a470f49bb6.patch":
version: 8.11.2
resolution: "acorn@patch:acorn@npm%3A8.11.2#~/.yarn/patches/acorn-npm-8.11.2-a470f49bb6.patch::version=8.11.2&hash=eac067"
Expand Down

0 comments on commit 1eb2ca7

Please sign in to comment.