PHP
Errors
Handle PHP API, transport, and serialization failures
Overview
This guide explains how to handle errors returned by the Insion SDK and inspect response details when troubleshooting failed requests.
Handle errors
Non-success responses throw InsionApiException; transport or serialization failures throw InsionException.
use Insion\Exceptions\InsionApiException;
use Insion\Exceptions\InsionException;
try {
$client->moderateARecord($request);
} catch (InsionApiException $error) {
echo $error->getCode();
echo $error->getBody();
throw $error;
} catch (InsionException $error) {
echo $error->getMessage();
throw $error;
}Empty responses
Operation return types are nullable because a successful response may have no body. Check for null before reading a model.
How is this guide?