summaryrefslogtreecommitdiff
blob: c098dc79eb8aaddcb62fda8e0c9fd355846d9e84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)
            ++ "."
         )
      (Http.BadBody string) ->
         (
            "Server response not understood:\""
            ++ string
            ++ "\"."
         )