sytsereitsma / mdbook-plantuml

mdBook preprocessor to render PlantUML diagrams to png images in the book output directory
MIT License
78 stars 15 forks source link

Improve error reporting #7

Closed sytsereitsma closed 5 years ago

sytsereitsma commented 5 years ago

The preprocessor uses stdout to communicate with the main mdBook process, so logging errors is kinda cumbersome. Simply capture the entire error chain and display it instead of the diagram.

PlantUML itself does not generate an error when a user forgets to add the @startuml/@enduml sections, resulting in no diagram file being generated. This in turn prints the rather unhelpful error message No such file or directory (os error 2). Add handling for this too.

Michael-F-Bryan commented 4 years ago

There's a better way of doing this. The preprocessor communicates with mdbook via STDIN and STDOUT, but STDERR is deliberately passed through to the parent console.

As an example, in mdbook-linkcheck I write diagnostics to STDERR so users get pretty error messages when their links are broken.

Screenshot from 2019-11-05 20-02-50