Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support error fallback #14

Merged
merged 2 commits into from
Dec 5, 2022
Merged

Support error fallback #14

merged 2 commits into from
Dec 5, 2022

Conversation

remcohaszing
Copy link
Owner

If the user provides errorFallback, it will be called when mermaid throws an error. It will receive the faulty code node, the mermaid error message, and the vfile as arguments, and may return a node to replace the code. If nothing is returned from the fallback, the code will be removed instead. To keep the code as-is, simply return the it from the fallback.

Also if no error fallback is provided, errors are now handled gracefully using file.fail().

Closes #10

If the user provides `errorFallback`, it will be called when mermaid
throws an error. It will receive the faulty code node, the mermaid error
message, and the vfile as arguments, and may return a node to replace
the code. If nothing is returned from the fallback, the code will be
removed instead. To keep the code as-is, simply return the it from the
fallback.

Also if no error fallback is provided, errors are now handled gracefully
using `file.fail()`.

Closes #10
index.ts Show resolved Hide resolved
@remcohaszing remcohaszing merged commit cefeaf4 into main Dec 5, 2022
@remcohaszing remcohaszing deleted the error-fallback branch September 20, 2023 19:52
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.

Handle invalid diagrams
2 participants