mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-29 09:32:57 +03:00
Improve error message.
This commit is contained in:
parent
7d14d8de88
commit
843a27eb0a
@ -49,17 +49,27 @@ get name secretsData =
|
||||
buildError : String -> List String -> BuildError
|
||||
buildError secretName availableEnvironmentVariables =
|
||||
{ message =
|
||||
[ Terminal.text "I expected to find this Secret in your environment variables but didn't find a match:\nSecrets.get \""
|
||||
, Terminal.red (Terminal.text secretName)
|
||||
, Terminal.text "\"\n\n"
|
||||
, Terminal.text "So maybe "
|
||||
, Terminal.yellow <| Terminal.text (sortMatches secretName availableEnvironmentVariables |> List.head |> Maybe.withDefault "")
|
||||
[ Terminal.text "I expected to find this Secret in your environment variables but didn't find a match:\n\nSecrets.get \""
|
||||
, Terminal.text secretName
|
||||
, Terminal.text "\"\n "
|
||||
, Terminal.red <| Terminal.text (underlineText (secretName |> String.length))
|
||||
, Terminal.text "\n\nSo maybe "
|
||||
, Terminal.yellow <| Terminal.text secretName
|
||||
, Terminal.text " should be "
|
||||
, Terminal.green <| Terminal.text secretName
|
||||
, Terminal.green <| Terminal.text (sortMatches secretName availableEnvironmentVariables |> List.head |> Maybe.withDefault "")
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
underlineText : Int -> String
|
||||
underlineText length =
|
||||
if length == 0 then
|
||||
""
|
||||
|
||||
else
|
||||
"^" ++ underlineText (length - 1)
|
||||
|
||||
|
||||
sortMatches missingSecret availableSecrets =
|
||||
let
|
||||
simpleMatch config separators needle hay =
|
||||
|
Loading…
Reference in New Issue
Block a user