mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-24 12:22:27 +03:00
Remove Recoverable type alias.
This commit is contained in:
parent
7d3043272d
commit
da45250fca
@ -2,7 +2,7 @@ module Route.Showcase exposing (ActionData, Data, Model, Msg, route)
|
||||
|
||||
import BackendTask exposing (BackendTask)
|
||||
import Css
|
||||
import FatalError exposing (FatalError, Recoverable)
|
||||
import FatalError exposing (FatalError)
|
||||
import Head
|
||||
import Head.Seo as Seo
|
||||
import Html.Styled exposing (..)
|
||||
|
@ -5,7 +5,7 @@ import BackendTask.File as File
|
||||
import BackendTask.Glob as Glob
|
||||
import Cloudinary
|
||||
import Date exposing (Date)
|
||||
import FatalError exposing (FatalError, Recoverable)
|
||||
import FatalError exposing (FatalError)
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
import Pages.Url exposing (Url)
|
||||
import Route
|
||||
@ -27,7 +27,10 @@ blogPostsGlob =
|
||||
|> Glob.toBackendTask
|
||||
|
||||
|
||||
allMetadata : BackendTask.BackendTask (Recoverable (File.FileReadError Decode.Error)) (List ( Route.Route, ArticleMetadata ))
|
||||
allMetadata :
|
||||
BackendTask.BackendTask
|
||||
{ fatal : FatalError, recoverable : File.FileReadError Decode.Error }
|
||||
(List ( Route.Route, ArticleMetadata ))
|
||||
allMetadata =
|
||||
blogPostsGlob
|
||||
|> BackendTask.map
|
||||
|
@ -76,7 +76,7 @@ data { pokedexNumber } =
|
||||
|> BackendTask.map Response.render
|
||||
|
||||
|
||||
get : String -> Decode.Decoder value -> BackendTask (FatalError.Recoverable BackendTask.Http.Error) value
|
||||
get : String -> Decode.Decoder value -> BackendTask { fatal : FatalError, recoverable : BackendTask.Http.Error } value
|
||||
get url decoder =
|
||||
BackendTask.Http.getWithOptions
|
||||
{ url = url
|
||||
|
@ -229,7 +229,7 @@ import BackendTask exposing (BackendTask)
|
||||
import BackendTask.Http
|
||||
import BackendTask.Internal.Glob exposing (Glob(..))
|
||||
import BackendTask.Internal.Request
|
||||
import FatalError exposing (FatalError, Recoverable)
|
||||
import FatalError exposing (FatalError)
|
||||
import Json.Decode as Decode
|
||||
import Json.Encode as Encode
|
||||
import List.Extra
|
||||
@ -1054,7 +1054,9 @@ so it's ideal to make this kind of assertion rather than having fallback behavio
|
||||
issues (like if we had instead ignored the case where there are two or more matching blog post files).
|
||||
|
||||
-}
|
||||
expectUniqueMatch : Glob a -> BackendTask (Recoverable String) a
|
||||
expectUniqueMatch :
|
||||
Glob a
|
||||
-> BackendTask { fatal : FatalError, recoverable : String } a
|
||||
expectUniqueMatch glob =
|
||||
glob
|
||||
|> toBackendTask
|
||||
|
@ -104,7 +104,7 @@ import Base64
|
||||
import Bytes exposing (Bytes)
|
||||
import Bytes.Decode
|
||||
import Dict exposing (Dict)
|
||||
import FatalError exposing (FatalError, Recoverable)
|
||||
import FatalError exposing (FatalError)
|
||||
import Json.Decode
|
||||
import Json.Encode as Encode
|
||||
import Pages.Internal.StaticHttpBody as Body
|
||||
@ -170,7 +170,7 @@ type alias Body =
|
||||
getJson :
|
||||
String
|
||||
-> Json.Decode.Decoder a
|
||||
-> BackendTask (Recoverable Error) a
|
||||
-> BackendTask { fatal : FatalError, recoverable : Error } a
|
||||
getJson url decoder =
|
||||
getWithOptions
|
||||
{ url = url
|
||||
@ -231,7 +231,7 @@ getWithOptions :
|
||||
, timeoutInMs : Maybe Int
|
||||
, cachePath : Maybe String
|
||||
}
|
||||
-> BackendTask (Recoverable Error) a
|
||||
-> BackendTask { fatal : FatalError, recoverable : Error } a
|
||||
getWithOptions request__ =
|
||||
let
|
||||
request_ : HashRequest.Request
|
||||
@ -258,7 +258,7 @@ post :
|
||||
String
|
||||
-> Body
|
||||
-> Expect a
|
||||
-> BackendTask (Recoverable Error) a
|
||||
-> BackendTask { fatal : FatalError, recoverable : Error } a
|
||||
post url body expect =
|
||||
request
|
||||
{ url = url
|
||||
@ -397,7 +397,7 @@ request :
|
||||
, timeoutInMs : Maybe Int
|
||||
}
|
||||
-> Expect a
|
||||
-> BackendTask (Recoverable Error) a
|
||||
-> BackendTask { fatal : FatalError, recoverable : Error } a
|
||||
request request__ expect =
|
||||
let
|
||||
request_ : HashRequest.Request
|
||||
@ -475,7 +475,7 @@ with this as a low-level detail, or you can use functions like [BackendTask.Http
|
||||
requestRaw :
|
||||
HashRequest.Request
|
||||
-> Expect a
|
||||
-> BackendTask (Recoverable Error) a
|
||||
-> BackendTask { fatal : FatalError, recoverable : Error } a
|
||||
requestRaw request__ expect =
|
||||
let
|
||||
request_ : HashRequest.Request
|
||||
|
@ -1,7 +1,4 @@
|
||||
module FatalError exposing
|
||||
( FatalError, fromString, recoverable
|
||||
, Recoverable
|
||||
)
|
||||
module FatalError exposing (FatalError, fromString, recoverable)
|
||||
|
||||
{-| The Elm language doesn't have the concept of exceptions or special control flow for errors. It just has
|
||||
Custom Types, and by convention types like `Result` and the `Err` variant are used to represent possible failure states
|
||||
@ -59,20 +56,11 @@ when these errors occur.
|
||||
|
||||
@docs FatalError, fromString, recoverable
|
||||
|
||||
@docs Recoverable
|
||||
|
||||
-}
|
||||
|
||||
import Pages.Internal.FatalError
|
||||
|
||||
|
||||
{-| -}
|
||||
type alias Recoverable error =
|
||||
{ fatal : FatalError
|
||||
, recoverable : error
|
||||
}
|
||||
|
||||
|
||||
{-| -}
|
||||
type alias FatalError =
|
||||
Pages.Internal.FatalError.FatalError
|
||||
@ -94,7 +82,7 @@ fromString string =
|
||||
|
||||
|
||||
{-| -}
|
||||
recoverable : { title : String, body : String } -> value -> Recoverable value
|
||||
recoverable : { title : String, body : String } -> error -> { fatal : FatalError, recoverable : error }
|
||||
recoverable info value =
|
||||
{ fatal = build info
|
||||
, recoverable = value
|
||||
|
@ -34,7 +34,7 @@ import BackendTask.Http
|
||||
import BackendTask.Internal.Request
|
||||
import Cli.OptionsParser as OptionsParser
|
||||
import Cli.Program as Program
|
||||
import FatalError exposing (FatalError, Recoverable)
|
||||
import FatalError exposing (FatalError)
|
||||
import Json.Decode as Decode
|
||||
import Json.Encode as Encode
|
||||
import Pages.Internal.Script
|
||||
@ -52,7 +52,7 @@ type Error
|
||||
|
||||
|
||||
{-| -}
|
||||
writeFile : { path : String, body : String } -> BackendTask (Recoverable Error) ()
|
||||
writeFile : { path : String, body : String } -> BackendTask { fatal : FatalError, recoverable : Error } ()
|
||||
writeFile { path, body } =
|
||||
BackendTask.Internal.Request.request
|
||||
{ name = "write-file"
|
||||
|
Loading…
Reference in New Issue
Block a user