mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-18 09:01:39 +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
|
|> BackendTask.Http.jsonBody
|
||||||
, expect =
|
, expect =
|
||||||
Decode.oneOf
|
Decode.field "elm-pages-internal-error" Decode.string
|
||||||
[ Decode.field "elm-pages-internal-error" Decode.string
|
|> Decode.maybe
|
||||||
|> Decode.andThen
|
|> Decode.andThen
|
||||||
(\errorKind ->
|
(\maybeInternalErrorCode ->
|
||||||
|
case maybeInternalErrorCode of
|
||||||
|
Just errorKind ->
|
||||||
|
--Decode.field "elm-pages-internal-error" Decode.string
|
||||||
|
-- |> Decode.andThen
|
||||||
|
(--\errorKind ->
|
||||||
if errorKind == "CustomBackendTaskNotDefined" then
|
if errorKind == "CustomBackendTaskNotDefined" then
|
||||||
FatalError.recoverable
|
FatalError.recoverable
|
||||||
{ title = "Custom BackendTask Error"
|
{ title = "Custom BackendTask Error"
|
||||||
@ -225,8 +230,10 @@ run portName input decoder =
|
|||||||
|> Decode.succeed
|
|> Decode.succeed
|
||||||
)
|
)
|
||||||
|> Decode.map Err
|
|> Decode.map Err
|
||||||
, decoder |> Decode.map Ok
|
|
||||||
]
|
Nothing ->
|
||||||
|
decoder |> Decode.map Ok
|
||||||
|
)
|
||||||
|> BackendTask.Http.expectJson
|
|> BackendTask.Http.expectJson
|
||||||
}
|
}
|
||||||
|> BackendTask.andThen BackendTask.fromResult
|
|> BackendTask.andThen BackendTask.fromResult
|
||||||
|
Loading…
Reference in New Issue
Block a user