2022-03-31 19:04:11 +03:00
|
|
|
module ErrorPage exposing (ErrorPage(..), Model, Msg, internalError, notFound, statusCode, view)
|
2022-03-29 21:48:04 +03:00
|
|
|
|
2022-03-31 19:04:11 +03:00
|
|
|
import Head
|
2022-03-29 21:48:04 +03:00
|
|
|
import Html exposing (Html)
|
2022-03-31 19:04:11 +03:00
|
|
|
import View exposing (View)
|
|
|
|
|
|
|
|
|
|
|
|
type alias Model =
|
|
|
|
()
|
|
|
|
|
|
|
|
|
|
|
|
type Msg
|
|
|
|
= NoOp
|
|
|
|
|
|
|
|
|
|
|
|
head : ErrorPage -> List Head.Tag
|
|
|
|
head errorPage =
|
|
|
|
[]
|
2022-03-29 21:48:04 +03:00
|
|
|
|
|
|
|
|
|
|
|
type ErrorPage
|
|
|
|
= NotFound
|
|
|
|
| InternalError String
|
|
|
|
|
|
|
|
|
|
|
|
notFound : ErrorPage
|
|
|
|
notFound =
|
|
|
|
NotFound
|
|
|
|
|
|
|
|
|
|
|
|
internalError : String -> ErrorPage
|
|
|
|
internalError =
|
|
|
|
InternalError
|
|
|
|
|
|
|
|
|
2022-03-31 19:04:11 +03:00
|
|
|
view : ErrorPage -> View msg
|
2022-03-29 21:48:04 +03:00
|
|
|
view error =
|
|
|
|
{ body =
|
2022-03-31 19:04:11 +03:00
|
|
|
[ Html.div []
|
2022-03-29 21:48:04 +03:00
|
|
|
[ Html.text "Hi! This is a NotFound error"
|
|
|
|
]
|
2022-03-31 19:04:11 +03:00
|
|
|
]
|
|
|
|
, title = "This is a NotFound Error"
|
2022-03-29 21:48:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
statusCode : ErrorPage -> number
|
|
|
|
statusCode error =
|
|
|
|
case error of
|
|
|
|
NotFound ->
|
|
|
|
404
|
|
|
|
|
|
|
|
InternalError _ ->
|
|
|
|
500
|