statamic / ssg

The official Statamic Static Site Generator
233 stars 24 forks source link

Basic failure on errors #72

Closed tao closed 2 years ago

tao commented 3 years ago

This is a draft to get some feedback on handling errors and failing correctly to stop a CI pipeline if something goes wrong, as described in #70. This adds a new option --failsafe to the command that will die the SSG process after generating all the pages. This allows you to view all the errors printed in the console instead of failing on the first occurrence of an error.

It works on warnings or skips now, but may need additional handling to deal with page rendering errors or "inline errors". For instance a Glide error as described in #70 may return a 200 Success response but the rendered page may not contain the appropriate images..? I'm not sure if Statamic requires some modification to catch these render errors. However, this basic modification should provide some safety against SSG errors.

If you don't provide --failsafe then SSG will continue as normal.