zine icon indicating copy to clipboard operation
zine copied to clipboard

dev server: improve rendering of build error messages

Open kristoff-it opened this issue 6 months ago • 0 comments

Follow-up from #10.

When the dev server is running and an automatic build errors out, we just show stderr verbatim to the user by placing the text in a <pre> element.

These error messages should be made nicer in a few ways:

  1. stop printing lines that come from the build system itself, which are also full of escape codes
  2. if the error is in a template, the same error message will be printed N times, once for each content file that uses is as a layout (directly or indirectly via template extension), ideally we would like to identify the error message that belongs to the current page and display that as the primary one.

The first task can be implemented by redirecting the error messages output by Zine to a different stream, be it a tmp file or maybe even just stdout. This behavior could be enabled via a flag that only the dev server is expected to use.

The second task requires either giving more structure to the error messages, or recognizing programmatically the current structure, in order to ultimately know where an error message begins and where it ends.

kristoff-it avatar Feb 09 '24 17:02 kristoff-it