Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'documents.body' type in 'Pages.Platform.init' isn't usable #115

Closed
tgelu opened this issue Jun 3, 2020 · 2 comments · Fixed by #121
Closed

'documents.body' type in 'Pages.Platform.init' isn't usable #115

tgelu opened this issue Jun 3, 2020 · 2 comments · Fixed by #121
Labels
bug Something isn't working

Comments

@tgelu
Copy link

tgelu commented Jun 3, 2020

The type of Pages.Platform.init has the following type definition for the documents property:

...
    , documents :
          List
              { extension : String
              , metadata : Decoder metadata
              , body : String -> Result String view
              }
...

If my documents.body function returns Err String because the markdown document has syntax errors then that's what I end up getting in the generated html file.

This is unexpected and not very useful. It would be nice if this body would fail the build in case the return value is Err _ but probably in such case it would be more suitable that the body would be a Decoder of some sort, though I am just speculating.

@dillonkearns
Copy link
Owner

Hello @tgelu, thank you for reporting the issue. This is a regression, and it's definitely not the intended behavior. I'll try to get a fix out for this soon. Sorry for the inconvenience, this is definitely an important one!

@dillonkearns dillonkearns added the bug Something isn't working label Jun 3, 2020
@dillonkearns
Copy link
Owner

I found some related Webpack issues:

webpack/webpack#708 (comment)

bigcommerce/cornerstone#1457

I'm not exactly sure what the ideal solution is, but I think I found a line where I can just check if there are any errors upon completion and do process.exit(1). The output is a little messy, but at least it will fail the build as expected. So I'll go with that solution for now.

Any ideas for a cleaner way to do it are very much welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants