Closed vjotchere closed 4 years ago
It should already do this.
When the exception is thrown, the entire Response object is passed into the exception and then parsed. The exception code should match the HTTP status code. The exception message should also be passed through from the Response as well, unless Plaid changed the shape of their error responses.
The PlaidRequestException
instance also has a getResponse()
method that will return the JSON decoded error object from Plaid.
$plaidRequestException->getCode(); // Should match the HTTP response code Plaid returned
$plaidRequestException->getMessage(); // Should be the display message from Plaid
$plaidRequestException->getResponse(); // Should be the full JSON decoded object Plaid returned in response body
the getResponse() method was what I was looking for and missed, thank you
When a request to a plaid endpoint fails due to an item error, typically from functions like 'getAccounts' and 'getTransactions', the PlaidRequestException outputs "Bad Request". It would be most useful for the exception handler to forward the error message sent from plaid using something like
\json_decode($response->getBody()->getContents())
so that that error message can be forwarded to the end users in instances where an update needs to happen through Link