Include response body in InvalidDataException
Is your feature request related to a problem? Please describe.
Sometimes, it is valuable to see the error response body, not just status code because it can contain an error reason.
Describe the solution you'd like
Include body in InvalidDataException's property
Describe alternatives you've considered
🤷🏾♂️
There are quite a few places where new InvalidDataException occurs. Is your suggestion to attach the entire reponse body to each of them?
I see. For now only to https://github.com/spawnia/sailor/blob/6a42958947e59fec1626e3957d9534899872cc65/src/Response.php#L35
But since this exception is kinda generic, the property is not appropriate.
Either introduce new exception (/subtype) or output the body (truncated?) into a message
InvalidDataException actually seems wrong in that place, since it deals with the status code. Let's introduce a new exception type here (not a subtype, just another type). Can you provide a pull request?
Thanks @simPod, i released a version that has the new exception with https://github.com/spawnia/sailor/releases/tag/v0.35.0.