Exception handling - 2Parale/2Performant-php GitHub Wiki
The methods throw exceptions that are all sub-classes of the \TPerformant\API\Exception\TPException
super-class.
InvalidResponseException
(extends APIException
) - thrown when the API response cannot be parsed as valid JSONClientException
(extends APIException
) - thrown when the server receives invalid user input and returns a 4XX status code (other than authentication-related issues)ServerException
(extends APIException
) - thrown when the server encountered an internal error and returns a 5XX status codeAPIException
(extends TPException
) - thrown in case of an authentication error or some other generic API issueConnectionException
(extends TransferException
) - thrown when the connection to the API server was initiated, but a networking error occurredTransferException
(extends TPException
) - thrown when the connection to the API server could not be initiatedTPException
- generic exception
You should wrap your code in try..catch
blocks in order to prevent issues.
try {
$me->getCommissions();
} catch(\TPerformant\API\Exception\TPException) {
// handle error
}