| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2022-01-30 12:27:36 +0100 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2022-01-30 12:27:36 +0100 | 
| commit | d222161a5bcce5c0f2848d9714ab509b4ba957ff (patch) | |
| tree | d1d0c4c8b19a87cf7a3b5cdd6ba17c39bb482940 /src/ElmModule/Update.elm | |
| parent | b1d6d8af0e31123d46e102bc68fcfd02d3b51256 (diff) | |
Seems to be working.
Diffstat (limited to 'src/ElmModule/Update.elm')
| -rw-r--r-- | src/ElmModule/Update.elm | 35 | 
1 files changed, 34 insertions, 1 deletions
| diff --git a/src/ElmModule/Update.elm b/src/ElmModule/Update.elm index 9fc9a93..7f02d79 100644 --- a/src/ElmModule/Update.elm +++ b/src/ElmModule/Update.elm @@ -1,6 +1,7 @@  module ElmModule.Update exposing (update)  -- Elm ------------------------------------------------------------------------- +import Http  -- Local Module ----------------------------------------------------------------  import Struct.Event @@ -27,6 +28,15 @@ update event model =           ((Update.Story.select_choice ix model), Cmd.none)        Struct.Event.None -> (model, Cmd.none) +      (Struct.Event.UserInputInProgress string) -> +         ( +            {model | ui = (Struct.UI.set_field_content string model.ui)}, +            Cmd.none +         ) + +      Struct.Event.UserInputValidated -> +         ((Update.Story.handle_prompt_input model), Cmd.none) +        (Struct.Event.LoadStory http_result) ->           case http_result of              (Ok story) -> @@ -47,7 +57,30 @@ update event model =                    {model |                       ui =                          (Struct.UI.display_string_error -                           "Failed to load story" +                           ( +                              "Failed to load story:\n" +                              ++ +                              ( +                                 case error of +                                    (Http.BadUrl details) -> +                                       ("Bad URL: " ++ details) + +                                    Http.Timeout -> "Timeout." +                                    Http.NetworkError -> "Network Error." +                                    (Http.BadStatus code) -> +                                       ( +                                          "Error code " +                                          ++ (String.fromInt code) +                                          ++ "." +                                       ) + +                                    (Http.BadBody details) -> +                                       ( +                                          "Invalid content: " +                                          ++ details +                                       ) +                              ) +                           )                             model.ui                          )                    }, | 


