mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-18 00:51:31 +03:00
Reduce oneOf decoder error noise for error case in BackendTask.Custom failures.
This commit is contained in:
parent
26670d4283
commit
a444c5af2c
@ -110,10 +110,15 @@ run portName input decoder =
|
||||
]
|
||||
|> BackendTask.Http.jsonBody
|
||||
, expect =
|
||||
Decode.oneOf
|
||||
[ Decode.field "elm-pages-internal-error" Decode.string
|
||||
Decode.field "elm-pages-internal-error" Decode.string
|
||||
|> Decode.maybe
|
||||
|> Decode.andThen
|
||||
(\errorKind ->
|
||||
(\maybeInternalErrorCode ->
|
||||
case maybeInternalErrorCode of
|
||||
Just errorKind ->
|
||||
--Decode.field "elm-pages-internal-error" Decode.string
|
||||
-- |> Decode.andThen
|
||||
(--\errorKind ->
|
||||
if errorKind == "CustomBackendTaskNotDefined" then
|
||||
FatalError.recoverable
|
||||
{ title = "Custom BackendTask Error"
|
||||
@ -225,8 +230,10 @@ run portName input decoder =
|
||||
|> Decode.succeed
|
||||
)
|
||||
|> Decode.map Err
|
||||
, decoder |> Decode.map Ok
|
||||
]
|
||||
|
||||
Nothing ->
|
||||
decoder |> Decode.map Ok
|
||||
)
|
||||
|> BackendTask.Http.expectJson
|
||||
}
|
||||
|> BackendTask.andThen BackendTask.fromResult
|
||||
|
Loading…
Reference in New Issue
Block a user