mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-25 12:52: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 BackendTask exposing (BackendTask)
|
||||||
import Css
|
import Css
|
||||||
import FatalError exposing (FatalError, Recoverable)
|
import FatalError exposing (FatalError)
|
||||||
import Head
|
import Head
|
||||||
import Head.Seo as Seo
|
import Head.Seo as Seo
|
||||||
import Html.Styled exposing (..)
|
import Html.Styled exposing (..)
|
||||||
|
@ -5,7 +5,7 @@ import BackendTask.File as File
|
|||||||
import BackendTask.Glob as Glob
|
import BackendTask.Glob as Glob
|
||||||
import Cloudinary
|
import Cloudinary
|
||||||
import Date exposing (Date)
|
import Date exposing (Date)
|
||||||
import FatalError exposing (FatalError, Recoverable)
|
import FatalError exposing (FatalError)
|
||||||
import Json.Decode as Decode exposing (Decoder)
|
import Json.Decode as Decode exposing (Decoder)
|
||||||
import Pages.Url exposing (Url)
|
import Pages.Url exposing (Url)
|
||||||
import Route
|
import Route
|
||||||
@ -27,7 +27,10 @@ blogPostsGlob =
|
|||||||
|> Glob.toBackendTask
|
|> 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 =
|
allMetadata =
|
||||||
blogPostsGlob
|
blogPostsGlob
|
||||||
|> BackendTask.map
|
|> BackendTask.map
|
||||||
|
@ -76,7 +76,7 @@ data { pokedexNumber } =
|
|||||||
|> BackendTask.map Response.render
|
|> 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 =
|
get url decoder =
|
||||||
BackendTask.Http.getWithOptions
|
BackendTask.Http.getWithOptions
|
||||||
{ url = url
|
{ url = url
|
||||||
|
@ -229,7 +229,7 @@ import BackendTask exposing (BackendTask)
|
|||||||
import BackendTask.Http
|
import BackendTask.Http
|
||||||
import BackendTask.Internal.Glob exposing (Glob(..))
|
import BackendTask.Internal.Glob exposing (Glob(..))
|
||||||
import BackendTask.Internal.Request
|
import BackendTask.Internal.Request
|
||||||
import FatalError exposing (FatalError, Recoverable)
|
import FatalError exposing (FatalError)
|
||||||
import Json.Decode as Decode
|
import Json.Decode as Decode
|
||||||
import Json.Encode as Encode
|
import Json.Encode as Encode
|
||||||
import List.Extra
|
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).
|
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 =
|
expectUniqueMatch glob =
|
||||||
glob
|
glob
|
||||||
|> toBackendTask
|
|> toBackendTask
|
||||||
|
@ -104,7 +104,7 @@ import Base64
|
|||||||
import Bytes exposing (Bytes)
|
import Bytes exposing (Bytes)
|
||||||
import Bytes.Decode
|
import Bytes.Decode
|
||||||
import Dict exposing (Dict)
|
import Dict exposing (Dict)
|
||||||
import FatalError exposing (FatalError, Recoverable)
|
import FatalError exposing (FatalError)
|
||||||
import Json.Decode
|
import Json.Decode
|
||||||
import Json.Encode as Encode
|
import Json.Encode as Encode
|
||||||
import Pages.Internal.StaticHttpBody as Body
|
import Pages.Internal.StaticHttpBody as Body
|
||||||
@ -170,7 +170,7 @@ type alias Body =
|
|||||||
getJson :
|
getJson :
|
||||||
String
|
String
|
||||||
-> Json.Decode.Decoder a
|
-> Json.Decode.Decoder a
|
||||||
-> BackendTask (Recoverable Error) a
|
-> BackendTask { fatal : FatalError, recoverable : Error } a
|
||||||
getJson url decoder =
|
getJson url decoder =
|
||||||
getWithOptions
|
getWithOptions
|
||||||
{ url = url
|
{ url = url
|
||||||
@ -231,7 +231,7 @@ getWithOptions :
|
|||||||
, timeoutInMs : Maybe Int
|
, timeoutInMs : Maybe Int
|
||||||
, cachePath : Maybe String
|
, cachePath : Maybe String
|
||||||
}
|
}
|
||||||
-> BackendTask (Recoverable Error) a
|
-> BackendTask { fatal : FatalError, recoverable : Error } a
|
||||||
getWithOptions request__ =
|
getWithOptions request__ =
|
||||||
let
|
let
|
||||||
request_ : HashRequest.Request
|
request_ : HashRequest.Request
|
||||||
@ -258,7 +258,7 @@ post :
|
|||||||
String
|
String
|
||||||
-> Body
|
-> Body
|
||||||
-> Expect a
|
-> Expect a
|
||||||
-> BackendTask (Recoverable Error) a
|
-> BackendTask { fatal : FatalError, recoverable : Error } a
|
||||||
post url body expect =
|
post url body expect =
|
||||||
request
|
request
|
||||||
{ url = url
|
{ url = url
|
||||||
@ -397,7 +397,7 @@ request :
|
|||||||
, timeoutInMs : Maybe Int
|
, timeoutInMs : Maybe Int
|
||||||
}
|
}
|
||||||
-> Expect a
|
-> Expect a
|
||||||
-> BackendTask (Recoverable Error) a
|
-> BackendTask { fatal : FatalError, recoverable : Error } a
|
||||||
request request__ expect =
|
request request__ expect =
|
||||||
let
|
let
|
||||||
request_ : HashRequest.Request
|
request_ : HashRequest.Request
|
||||||
@ -475,7 +475,7 @@ with this as a low-level detail, or you can use functions like [BackendTask.Http
|
|||||||
requestRaw :
|
requestRaw :
|
||||||
HashRequest.Request
|
HashRequest.Request
|
||||||
-> Expect a
|
-> Expect a
|
||||||
-> BackendTask (Recoverable Error) a
|
-> BackendTask { fatal : FatalError, recoverable : Error } a
|
||||||
requestRaw request__ expect =
|
requestRaw request__ expect =
|
||||||
let
|
let
|
||||||
request_ : HashRequest.Request
|
request_ : HashRequest.Request
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
module FatalError exposing
|
module FatalError exposing (FatalError, fromString, recoverable)
|
||||||
( FatalError, fromString, recoverable
|
|
||||||
, Recoverable
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| The Elm language doesn't have the concept of exceptions or special control flow for errors. It just has
|
{-| 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
|
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 FatalError, fromString, recoverable
|
||||||
|
|
||||||
@docs Recoverable
|
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
import Pages.Internal.FatalError
|
import Pages.Internal.FatalError
|
||||||
|
|
||||||
|
|
||||||
{-| -}
|
|
||||||
type alias Recoverable error =
|
|
||||||
{ fatal : FatalError
|
|
||||||
, recoverable : error
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{-| -}
|
{-| -}
|
||||||
type alias FatalError =
|
type alias FatalError =
|
||||||
Pages.Internal.FatalError.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 =
|
recoverable info value =
|
||||||
{ fatal = build info
|
{ fatal = build info
|
||||||
, recoverable = value
|
, recoverable = value
|
||||||
|
@ -34,7 +34,7 @@ import BackendTask.Http
|
|||||||
import BackendTask.Internal.Request
|
import BackendTask.Internal.Request
|
||||||
import Cli.OptionsParser as OptionsParser
|
import Cli.OptionsParser as OptionsParser
|
||||||
import Cli.Program as Program
|
import Cli.Program as Program
|
||||||
import FatalError exposing (FatalError, Recoverable)
|
import FatalError exposing (FatalError)
|
||||||
import Json.Decode as Decode
|
import Json.Decode as Decode
|
||||||
import Json.Encode as Encode
|
import Json.Encode as Encode
|
||||||
import Pages.Internal.Script
|
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 } =
|
writeFile { path, body } =
|
||||||
BackendTask.Internal.Request.request
|
BackendTask.Internal.Request.request
|
||||||
{ name = "write-file"
|
{ name = "write-file"
|
||||||
|
Loading…
Reference in New Issue
Block a user