haskell-servant / servant-elm

Automatically derive Elm functions to query servant webservices
BSD 3-Clause "New" or "Revised" License
164 stars 48 forks source link

Allow overriding the `Http.Error` type #74

Closed sandydoo closed 7 months ago

sandydoo commented 7 months ago

We commonly design APIs that return error messages in the response body together with an error status code. The BadStatus constructor in Http.Error doesn't provide the response body anymore. To access these messages, we're then forced to roll our own error type as suggested by the Elm docs.

To make this work with elm-servant, we need to be able to configure:

  1. The error type for HTTP requests (Http.Error)
  2. The expect-style functions that interpret the response body (Http.expectJson and Http.expectString).