summaryrefslogtreecommitdiff
blob: a32a7c79817e0502786aa1bad593ce3ad3132aa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
            ++ "\"."
         )