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

Add initThrowsErrors() #2379

Merged
merged 3 commits into from
Apr 19, 2022
Merged

Conversation

MindaugasLaganeckas
Copy link
Member

@MindaugasLaganeckas MindaugasLaganeckas commented Oct 4, 2021

📑 Summary

looking into several issues related to propagating the syntax errors from mermaid to other clients, e.g. mermaid-cli. By inspecting the code of mermaid.js (

} catch (e) {
), I can see that all errors are caught on the mermaid level and never propagated to the clients. That is a problem described in several issues. One is here (mermaid-js/mermaid-cli#138)

Resolves #2378

📏 Design Decisions

Make another function called init(), rename existing one to initThrowsErrors(). The new init() calls initThrowsErrors() and try-catch lives in init(). Then clients can choose either to call init() or initThrowsErrors()

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added unit/e2e tests (if appropriate)
  • 🔖 targeted develop branch

@ashishjain0512
Copy link
Collaborator

Hey

Is this PR still a draft?

Regards,
Ashish

@MindaugasLaganeckas
Copy link
Member Author

@ashishjain0512 : yes, I want to add few tests. Thanks for asking! Would you be willing to have a look at the idea and provide early feedback?

@MindaugasLaganeckas MindaugasLaganeckas marked this pull request as ready for review December 3, 2021 14:20
@MindaugasLaganeckas
Copy link
Member Author

I have received a confirmation of the validity of the idea from @knsv in slack thread https://mermaid-talk.slack.com/archives/CL256P19N/p1633101057039000 Now if someone can review the implementation of the idea? 😉

@johanneswuerbach
Copy link

Looks like this was approved, any further changes required here? :-)

@MindaugasLaganeckas
Copy link
Member Author

MindaugasLaganeckas commented Jan 17, 2022

Please, let me know if the PR can be somehow improved, so that it can be merged.
I think the motivation I have provided is enough to see the PR's value.
😄

@MindaugasLaganeckas
Copy link
Member Author

The newest issue related to my PR in mermaid-cli project: mermaid-js/mermaid-cli#276

@mmorel-35 mmorel-35 merged commit 473aced into mermaid-js:develop Apr 19, 2022
MindaugasLaganeckas added a commit to MindaugasLaganeckas/mermaid that referenced this pull request May 18, 2022
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.

Propage errors from the init() mether
4 participants