Improve error messages.

This commit is contained in:
Dillon Kearns 2019-07-22 15:23:41 -07:00
parent d0674f809f
commit 37493aaff7
2 changed files with 35 additions and 5 deletions

View File

@ -52,11 +52,19 @@ allData =
, pages = successPageListings
}
Err _ ->
Err (Element.text "Error... TODO give more details")
Err errors ->
Err (renderErrors errors)
Err errorErrorMarkList ->
Err (Element.text "Error... TODO give more details")
Err errors ->
Err (renderErrors errors)
renderErrors : List Mark.Error.Error -> Element msg
renderErrors errors =
errors
|> List.map (Mark.Error.toHtml Mark.Error.Light)
|> List.map Element.html
|> Element.column []
pages : List ( List String, String )
@ -219,6 +227,15 @@ Morbi ut porta justo. Integer ac eleifend sem. Fusce sed auctor velit, et condim
This is a code block
With Multiple lines
|> H1
Articles
|> IndexContent
posts = articles
Here are a few articles you might like.
|> H1
My section on /lists/

View File

@ -239,7 +239,20 @@ indexContent content =
(\postsPath ->
content
)
|> Mark.field "posts" Mark.string
|> Mark.field "posts"
(Mark.string
|> Mark.verify
(\postDirectory ->
if postDirectory == "articles" then
Ok "articles"
else
Err
{ title = "Could not find posts path `" ++ postDirectory ++ "`"
, message = "Must be one of " :: [ "articles" ]
}
)
)
|> Mark.toBlock