Right now in my own usage of shippy I get errors such as:
400 Client error: `POST https://apis.fedex.com/rate/v1/rates/quotes` resulted in a `400 Bad Request` response:
{"transactionId":"..snipped..","errors":[{"code":"CURRENCY.TYPE.SELECT","message":"Please enter Currency","parameterList":[{"key":"COMMODITY_INDEX","value":"1"}]}]}
This is returned from getErrors() as a string representation of a guzzle exxception error here:
|
$data['__errors'][] = "{$response->getStatusCode()} {$response->getErrorMessage()}"; |
I'm not a super fan of turning exceptions into strings to later be returned because there can be valuable information in the exception that can be retrieved later. Instead of it being a string could we instead send the exception as is into errors? I haven't looked into why shippy stringifys these exceptions
Would you accept a PR that changes how this functions/works? __toString() is a method on all Exceptions so in the end it could still be a string it would just allow better visibility into the exception
Right now in my own usage of shippy I get errors such as:
This is returned from getErrors() as a string representation of a guzzle exxception error here:
shippy/src/carriers/AbstractCarrier.php
Line 232 in b47d681
I'm not a super fan of turning exceptions into strings to later be returned because there can be valuable information in the exception that can be retrieved later. Instead of it being a string could we instead send the exception as is into errors? I haven't looked into why shippy stringifys these exceptions
Would you accept a PR that changes how this functions/works? __toString() is a method on all Exceptions so in the end it could still be a string it would just allow better visibility into the exception