http
http copied to clipboard
Accessing `Http.Error` with task requests
task doesn't appear to provide any way of getting Http.Error values when errors occur.
https://github.com/elm/http/blob/34a9a27411c2492d3e247ac75cd48e22b473bef5/src/Http.elm#L538-L543
important values like response body when http status != 2xx and http headers are not stored in the Http.Error values at all
Alternatives are
-
https://package.elm-lang.org/packages/jzxhuang/http-extras/latest/Http-Detailed#Error
type Error body = BadUrl String | Timeout | NetworkError | BadStatus Http.Metadata body | BadBody Http.Metadata body String -
https://package.elm-lang.org/packages/choonkeat/elm-ext-http/latest/Ext-Http#Error
type Error a = BadUrl String | Timeout | NetworkError | BadStatus Http.Metadata a | BadJson Http.Metadata a Json.Decode.Error