Replace one call to permanent error function.

This commit is contained in:
Dillon Kearns 2020-10-07 11:45:54 -07:00
parent 962c397d75
commit 560be03e85
2 changed files with 23 additions and 12 deletions

View File

@ -452,7 +452,7 @@ nextStep config siteMetadata mode secrets allRawResponses errors (StaticResponse
|> List.concatMap
(\( path, NotFetched request rawResponses ) ->
let
( status, continuationRequests ) =
staticRequestsStatus =
StaticHttpRequest.cacheRequestResolution
ApplicationType.Cli
request
@ -469,10 +469,12 @@ nextStep config siteMetadata mode secrets allRawResponses errors (StaticResponse
)
maybePermanentError =
StaticHttpRequest.permanentError
ApplicationType.Cli
request
usableRawResponses
case staticRequestsStatus of
StaticHttpRequest.HasPermanentError theError ->
Just theError
_ ->
Nothing
decoderErrors =
maybePermanentError

View File

@ -1,4 +1,4 @@
module Pages.StaticHttpRequest exposing (Error(..), Request(..), cacheRequestResolution, permanentError, resolve, resolveUrls, strippedResponses, toBuildError, urls)
module Pages.StaticHttpRequest exposing (Error(..), Request(..), Status(..), cacheRequestResolution, permanentError, resolve, resolveUrls, strippedResponses, toBuildError, urls)
import BuildError exposing (BuildError)
import Dict exposing (Dict)
@ -145,14 +145,15 @@ cacheRequestResolution :
ApplicationType
-> Request value
-> RequestsAndPending
-> ( Status value, List (Secrets.Value Pages.StaticHttp.Request.Request) )
-> Status value
cacheRequestResolution =
cacheRequestResolutionHelp []
type Status value
= CompleteWithError Error
| Complete value
= Incomplete (List (Secrets.Value Pages.StaticHttp.Request.Request))
| HasPermanentError Error
| Complete value -- TODO include stripped responses?
cacheRequestResolutionHelp :
@ -160,7 +161,7 @@ cacheRequestResolutionHelp :
-> ApplicationType
-> Request value
-> RequestsAndPending
-> ( Status value, List (Secrets.Value Pages.StaticHttp.Request.Request) )
-> Status value
cacheRequestResolutionHelp foundUrls appType request rawResponses =
case request of
Request ( urlList, lookupFn ) ->
@ -169,7 +170,15 @@ cacheRequestResolutionHelp foundUrls appType request rawResponses =
cacheRequestResolutionHelp urlList appType nextRequest rawResponses
Err error ->
( CompleteWithError error, urlList ++ foundUrls )
case error of
MissingHttpResponse string ->
Incomplete (urlList ++ foundUrls)
DecoderError string ->
HasPermanentError error
UserCalledStaticHttpFail string ->
HasPermanentError error
Done value ->
( Complete value, [] )
Complete value