workos-ruby icon indicating copy to clipboard operation
workos-ruby copied to clipboard

Response body missing in the exception

Open tgodfrey opened this issue 10 months ago • 1 comments

When 400 series errors are encountered, the response body is suppressed from the exception which is thrown. A few fields are pulled out, but it would be helpful to include the full JSON response in the exception.

https://github.com/workos/workos-ruby/blob/9e47c7c70642415f4b10d812354f8739b2ded19e/lib/workos/client.rb#L90-L134

For example:

 when 400
        raise InvalidRequestError.new(
          message: json['message'],
          http_status: http_status,
          request_id: response['x-request-id'],
          code: json['code'],
          errors: json['errors'],
          body: json
        )

tgodfrey avatar Apr 23 '24 16:04 tgodfrey