mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-09-30 08:38:22 +00:00
Externalize error messages
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
module Page.Queue.Data exposing
|
||||
( Model
|
||||
( FormState(..)
|
||||
, Model
|
||||
, Msg(..)
|
||||
, QueueView(..)
|
||||
, emptyModel
|
||||
@@ -20,7 +21,7 @@ import Util.Maybe
|
||||
|
||||
type alias Model =
|
||||
{ state : JobQueueState
|
||||
, error : String
|
||||
, formState : FormState
|
||||
, pollingInterval : Float
|
||||
, init : Bool
|
||||
, stopRefresh : Bool
|
||||
@@ -32,6 +33,11 @@ type alias Model =
|
||||
}
|
||||
|
||||
|
||||
type FormState
|
||||
= InitialForm
|
||||
| HttpError Http.Error
|
||||
|
||||
|
||||
type QueueView
|
||||
= CurrentJobs
|
||||
| QueueAll
|
||||
@@ -44,7 +50,7 @@ type QueueView
|
||||
emptyModel : Model
|
||||
emptyModel =
|
||||
{ state = Api.Model.JobQueueState.empty
|
||||
, error = ""
|
||||
, formState = InitialForm
|
||||
, pollingInterval = 1200
|
||||
, init = False
|
||||
, stopRefresh = False
|
||||
|
@@ -4,10 +4,8 @@ import Api
|
||||
import Comp.YesNoDimmer
|
||||
import Data.Flags exposing (Flags)
|
||||
import Page.Queue.Data exposing (..)
|
||||
import Ports
|
||||
import Task
|
||||
import Time
|
||||
import Util.Http
|
||||
|
||||
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
|
||||
@@ -42,7 +40,7 @@ update flags msg model =
|
||||
( { model | state = s, stopRefresh = False }, refresh )
|
||||
|
||||
StateResp (Err err) ->
|
||||
( { model | error = Util.Http.errorToString err }, Cmd.none )
|
||||
( { model | formState = HttpError err }, Cmd.none )
|
||||
|
||||
StopRefresh ->
|
||||
( { model | stopRefresh = True, init = False }, Cmd.none )
|
||||
|
Reference in New Issue
Block a user