Open barryoneill opened 3 years ago
In the http4s client, when a codec fails to parse the expected JSON, it creates a FailedRequest model:
FailedRequest
def parseJson[F[_]: Sync, T]( className: String, r: org.http4s.Response[F] )(implicit decoder: io.circe.Decoder[T]): F[T] = r.attemptAs[T].value.flatMap { case Right(value) => Sync[F].pure(value) case Left(error) => Sync[F].raiseError(new com.foo.bar.api.v2.errors.FailedRequest( r.status.code, s"Invalid json for class[" + className + "]", None, error)) }
It would be desirable to have the headers from the response to be included in this FailedRequest.
@barryoneill we'd be happy to consider your PR ;-)
Just a moment while I convert it all to tagless final :)
/unsubscribe
In the http4s client, when a codec fails to parse the expected JSON, it creates a
FailedRequest
model:It would be desirable to have the headers from the response to be included in this
FailedRequest
.