Open AntonLebiodkin opened 5 years ago
@AntonLebiodkin there's some explanation here. You can replace Http.Error with your own custom error type and in the BadStatus case attempt to run a decoder on the body to get the validation errors.
There's no issue of creating your own version of Http.Error and extend the handling of missing 400 - body responses. The problem is with usage of third party packages like RemoteData. Those packages import Http.Error directly and are not aware about the custom handlers you've created. This force you to copy paste a lot of type declarations.
Hi, folks! We have our Elm app where the server sends to us some objects with validation errors in them with BadStatus. Previously we handled response body from BadStatus Http.Error. But after contract change in elm/http (previously evancz/elm-http), we can't figure out how to get it correctly.
P.S. We're using Http.task, so seems we can't add there
expect
field to get additional info, cause it exists only on Http.request