Skip to content

Impossible to read response body for a failed request #682

@Kolyunya

Description

@Kolyunya

Jane version(s) affected: 7.4.0

Description
Exceptions do not contain server response body thus not allowing to understand what exactly went wrong during the request.

E.g. we're trying to create some resource, but server-side validation of some field failed and the server returned a 422 response. Jane would throw an UnprocessableEntityException that we can catch in our client code, but we can't show the user what exactly went wrong because we don't have access to the response body, containing that information.

I'm not sure whether something's wrong with my OpenAPI specification, but exception classes that are generated by Jane only contain the Unprocessable entity message and nothing else.

How to reproduce

  1. Send POST /collection with payload that would cause 422 error.
  2. Catch UnprocessableEntityException.
  3. Try to render human-readable error message with details of which particular field is invalid and why.

Possible Solution
I believe exceptions must contain a response body with error details at least in raw format in case there's no easy way to standardize it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions