git.iko.soy/kchnrave.github.io
on master help sign in
kchnrave.github.io/app/ErrorPage.elm
73 lines 1.2 kB history raw
1module ErrorPage exposing (ErrorPage(..), Model, Msg, head, init, internalError, notFound, statusCode, update, view)
3import Effect exposing (Effect)
4import Element exposing (..)
5import Head
6import View exposing (View)
9type Msg
10 = Increment
13type alias Model =
14 { count : Int
15 }
18init : ErrorPage -> ( Model, Effect Msg )
19init errorPage =
20 ( { count = 0 }
21 , Effect.none
22 )
25update : ErrorPage -> Msg -> Model -> ( Model, Effect Msg )
26update errorPage msg model =
27 case msg of
28 Increment ->
29 ( { model | count = model.count + 1 }, Effect.none )
32head : ErrorPage -> List Head.Tag
33head errorPage =
34 []
37type ErrorPage
38 = NotFound
39 | InternalError String
42notFound : ErrorPage
43notFound =
44 NotFound
47internalError : String -> ErrorPage
48internalError =
49 InternalError
52view : ErrorPage -> Model -> View Msg
53view error model =
54 { body =
55 text "oh no"
56 , title =
57 case error of
58 NotFound ->
59 "Page Not Found"
61 InternalError string ->
62 "Unexpected Error"
63 }
66statusCode : ErrorPage -> number
67statusCode error =
68 case error of
69 NotFound ->
70 404
72 InternalError _ ->
73 500