mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-25 09:21:57 +03:00
Improve error messages.
This commit is contained in:
parent
d0674f809f
commit
37493aaff7
@ -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/
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user