| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-12-21 23:03:02 +0100 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-12-21 23:03:02 +0100 | 
| commit | 6f7fb373813862c97ff657d3db62b882c29982e3 (patch) | |
| tree | ca1c92b7eb35355b050751cf4d0db5eae6720101 /src/shared/elm/Util | |
| parent | 23ecc837380e2653d600e0246f50db30a3a238fc (diff) | |
Converts the login module to Elm 0.19.
Diffstat (limited to 'src/shared/elm/Util')
| -rw-r--r-- | src/shared/elm/Util/Http.elm | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/src/shared/elm/Util/Http.elm b/src/shared/elm/Util/Http.elm new file mode 100644 index 0000000..a32a7c7 --- /dev/null +++ b/src/shared/elm/Util/Http.elm @@ -0,0 +1,24 @@ +module Util.Http exposing (error_to_string) + +import Http + +error_to_string : Http.Error -> String +error_to_string error = +   case error of +      (Http.BadUrl string) -> ("Invalid URL: \"" ++ string ++ "\"") +      Http.Timeout -> "Timed out" +      Http.NetworkError -> "Connection lost, network error." +      (Http.BadStatus response) -> +         ( +            "The HTTP request failed: " +            ++ (String.fromInt response.status.code) +            ++ ", " +            ++ response.status.message +            ++ "." +         ) +      (Http.BadPayload string _) -> +         ( +            "Server response not understood:\"" +            ++ string +            ++ "\"." +         ) | 


