jbn / IPlantUML

A Python package which defines a PlantUML cell magic for IPython.
MIT License
96 stars 28 forks source link

Show PlantUML syntax errors properly #22

Open fuhrmanator opened 2 years ago

fuhrmanator commented 2 years ago

This package works great (and is simple) in colab.research.google.com (it's how I'm using it).

But, whenever there's a mistake in the PlantUML source, there's a traceback that is not useful, instead of a helpful error that PlantUML's server is giving.

For example, in the following cell, note is mistyped with a space in the middle: no te which is a syntax error:

%%plantuml

@startuml
Alice->Bob: Authentication Request
no te right of Bob: Bob thinks about it
Bob->Alice: Authentication Response
@enduml

If I try that on the PlantUML server, I see this info:

image

If I try it in colab, I get this:

---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
[<ipython-input-61-2db41d0c2e9c>](https://localhost:8080/#) in <module>()
----> 1 get_ipython().run_cell_magic('plantuml', '', '\n@startuml\nAlice->Bob: Authentication Request\nno te right of Bob: Bob thinks about it\nBob->Alice: Authentication Response\n@enduml')

4 frames
[/usr/lib/python3.7/subprocess.py](https://localhost:8080/#) in check_call(*popenargs, **kwargs)
    361         if cmd is None:
    362             cmd = popenargs[0]
--> 363         raise CalledProcessError(retcode, cmd)
    364     return 0
    365 

CalledProcessError: Command '['plantweb', '--format', 'auto', 'e7a6b5e9-9c57-49b2-9bde-1ae3e8bbadbd.uml']' returned non-zero exit status 1.