summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/shared/elm/Shared/Util/Http.elm')
-rw-r--r-- | src/shared/elm/Shared/Util/Http.elm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/shared/elm/Shared/Util/Http.elm b/src/shared/elm/Shared/Util/Http.elm new file mode 100644 index 0000000..2e57819 --- /dev/null +++ b/src/shared/elm/Shared/Util/Http.elm @@ -0,0 +1,22 @@ +module Shared.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) + ++ "." + ) + (Http.BadBody string) -> + ( + "Server response not understood:\"" + ++ string + ++ "\"." + ) |