fission-codes / landing-page

Fission home page
https://fission.codes
Other
9 stars 2 forks source link

Push content parsing error handling further upstream #25

Closed matheus23 closed 4 years ago

matheus23 commented 4 years ago

At the moment, running elm-pages build will exit successfully, even if there are ill-formed yaml files.

That means: If you're not carefully checking all routes for content mistakes, it's easy to push broken pages to production.

It is possible to report content parsing errors to elm-pages in a way that elm-pages build would then fail by reporting errors here: https://github.com/fission-suite/landing-page/blob/350cf6bffb39027b59bb4f2ef99a5b378b90a5f3/src/Content/Parsers.elm#L47

(You can see how we always return Ok at the moment.)

It'd also remove some complexity from the codebase, as there's more stuff handled by elm-pages.

Please let me know how you'd prioritize this @bmann

icidasset commented 4 years ago

Oh right, I remember now why this is missing. The yaml parser was missing a few pieces for this to work.

If we switch to a different yaml parser, which only has been released recently, it should work. https://package.elm-lang.org/packages/MaybeJustJames/yaml/latest/

matheus23 commented 4 years ago

Switching to the new yaml package should be fairly straight-forward. It's public api seems very similar. :+1: