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

Mermaid syntax errors are not displayed #276

Closed
fconil opened this issue Apr 6, 2022 · 6 comments · Fixed by #321
Closed

Mermaid syntax errors are not displayed #276

fconil opened this issue Apr 6, 2022 · 6 comments · Fixed by #321

Comments

@fconil
Copy link

fconil commented Apr 6, 2022

Describe the bug
When the input file contains a syntax error, the output is "Generating single mermaid chart" and the generated image contains "Syntax error in graph".

To Reproduce
Steps to reproduce the behavior:

I am using the docker container

  1. My input file is in $HOME/Mermaid folder
  2. Execute : docker run -u 1000 -it --rm -v $HOME/Mermaid:/data minlag/mermaid-cli -i "/data/seq-diagram.mmd" -o "/data/seq-diagram.png"
  3. You get the "Generating single mermaid chart" message and the generated image contains "Syntax error in graph"

Inside the container I do not get any other message

  1. My input file is in $HOME/Mermaid folder
  2. Go inside the container : docker run -u 1000 -it --rm --entrypoint /bin/sh -v $HOME/Progs/Mermaid:/data minlag/mermaid-cli
  3. Execute : ./node_modules/.bin/mmdc -p "/puppeteer-config.json" -i "/data/seq-diagram.mmd" -o "/data/seq-diagram.png"
  4. You get the "Generating single mermaid chart" message and the generated image contains "Syntax error in graph"

Expected behavior
I would like to see the syntax error so that I can fix it

Parse error on line 30:
...ger->>ABC auth->> User    SMS au
-----------------------^
Expecting 'TXT', got 'SOLID_ARROW'

Screenshots
seq-diagram

Desktop:

  • OS: Ubuntu
  • Version 20.04
  • Browser inside the container :
$ /usr/bin/chromium-browser --version
Chromium 99.0.4844.84

$ ./node_modules/.bin/mmdc -p "/puppeteer-config.json" --version
8.14.0

Additional context
I am not used to JavaScript but it seems like the following question in SO : https://stackoverflow.com/questions/51907677/log-console-calls-made-in-client-side-code-from-the-puppeteer-node-js-process

It seems that you could catch console events that happen in puppeteer / chromium to log them in Node ... as I understand it

@MindaugasLaganeckas
Copy link
Member

We are aware of the issue and I have created a PR a long time ago in the mermaid project to fix the issue mermaid-js/mermaid#2379
You are welcome to support my PR by giving 👍

@multimeric
Copy link

It looks like your patch is now released upstream: mermaid-js/mermaid@473aced. Does anything need to be done to log the errors to the console when using mermaid-cli?

@MindaugasLaganeckas
Copy link
Member

@multimeric : maybe you can help me a bit. I do not see that this change has been actually released. There is no mention in the mermaid release notes and if I call the new function, I get an error: https://github.com/mermaid-js/mermaid-cli/runs/6467149774?check_suite_focus=true
Unfortunately, I do not have the time now to investigate further.

@multimeric
Copy link

Oh right, so your new function isn't being exported unfortunately:
https://github.com/mermaid-js/mermaid/blob/24eb2123e4670bff6bbde9746b17b005e94ccf34/src/mermaid.js#L209-L225

You may need to add a PR to add it to the exported object.

@MindaugasLaganeckas
Copy link
Member

Thank you! 😄

@MindaugasLaganeckas
Copy link
Member

@multimeric Done! mermaid-js/mermaid#3052 Thank you for your help! You are welcome to create PRs for the functionality which is missing in mermaid-cli - I will review them and accept if no issues 😄

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 a pull request may close this issue.

3 participants