no file context for "WARNING in "uml" directive: remote server has returned error 400"
anb0s opened this issue · 4 comments
during investigation of #74 or some other rendering issues with Kroki instance (includes PlantUML server) i'm facing issue like
WARNING in "uml" directive: remote server has returned error 400
but there is no context about the file and it's difficult (not possible) to find the markdown file that has the issue.
Fixing the version to 3.4.3
shows callstack with previous exception message:
ERROR - Error reading page 'Guidance/API/20_OIE_Usage_Experience.md': 'PlantUMLHTTPError' object has no attribute 'message'
Traceback (most recent call last):
...
File "/usr/local/lib/python3.9/site-packages/markdown/core.py", line 261, in convert
self.lines = prep.run(self.lines)
File "/usr/local/lib/python3.9/site-packages/plantuml_markdown.py", line 124, in run
text1, idx1 = self._replace_block(text[idx:])
File "/usr/local/lib/python3.9/site-packages/plantuml_markdown.py", line 182, in _replace_block
diagram = self._render_diagram(code, requested_format)
File "/usr/local/lib/python3.9/site-packages/plantuml_markdown.py", line 252, in _render_diagram
diagram = self._render_remote_uml_image(code, requested_format)
File "/usr/local/lib/python3.9/site-packages/plantuml_markdown.py", line 281, in _render_remote_uml_image
return PlantUML("%s/%s/" % (self.config['server'], img_format)).processes(plantuml_code)
File "/usr/local/lib/python3.9/site-packages/plantuml.py", line 173, in processes
raise PlantUMLHTTPError(response, content)
File "/usr/local/lib/python3.9/site-packages/plantuml.py", line 56, in __init__
if not self.message:
AttributeError: 'PlantUMLHTTPError' object has no attribute 'message'
It would be good to see the context like file-path (like it was in the exception) and if possible the line (we have many diagrams in one file) or may be snippet of PlantUML text to search.
Additionally the WARNING
message does not break the mkdocs strict build like it is for other WARNNG messages -> may be should create another issue to investigate...
Kroki uses a different diagram encoding than PlantUML; sending plantuml-encoded diagrams to Kroki does not work.
The error arise from the plantuml
Python package, which is not mine.
I can implement kroki diagram encoding so that it is compatible.
Give me some time...
Kroki uses a different diagram encoding than PlantUML; sending plantuml-encoded diagrams to Kroki does not work.
It works as we are using it for long time now, e.g. for own Kroki instance we are using the URL with endpoint plantuml
:
plantuml_markdown:
server: https://own-kroki/api/plantuml
The error arise from the
plantuml
Python package, which is not mine.
Yes i see, thanks! It looks like i'm facing two different issues: the one with maps not yet supported in Kroki and some broken diagrams, but the error message is not clear...
I can implement kroki diagram encoding so that it is compatible. Give me some time...
Wow 👍 that would be good!
I think the option for disabling map is good to go and should not be disabled in case of Kroki-server, because i hope Kroki will add maps support soon and then it should work without changing the logic here...
Just to show example in VSCode (that also uses the Kroki/plantuml endpoint) for such broken diagram (merge conflicts) i've faced, it shows error message returned from server with line number:
So it shows the bad line in the diagram sended to PlantUML at Kroki, it would be good to see the markdown file-name with line number of diagram and the error message returned from server.
Hi @anb0s, I've released version 3.7.0
which adds support for the Kroki server; use the kroki_server
configuration for setting the service URL (without the /plantuml
suffix). See the README.md
for details.
And error messages from Kroki server are now inserted in the output, as does VSCode.
The filename is not accessible (at least as I know) as markdown can be processed from a string, maybe generated dynamically.
But the error message replaces the diagram, so it can help you find where the error is.