InsionInsion
PHP

Errors

Handle transport, serialization, and API failures

Methods throw Insion\Exceptions\InsionApiException for non-success API responses and Insion\Exceptions\InsionException for transport or serialization failures.

try { $client->deleteARecord(new DeleteApiV1IngestRequest(['clientId' => 'post-123'])); }
catch (InsionApiException $error) { echo $error->getCode(); echo $error->getBody(); }

Error types and handling

ExceptionWhen it is raisedUseful data
InsionApiExceptionInsion returned a non-success HTTP response.HTTP status via getCode() and response content via getBody().
InsionExceptionTransport failure or response serialization failure.Message and previous exception.

Treat a nullable method result differently from an exception: null is an empty successful response, while an exception means the request did not produce a usable successful result. Use the status code to decide whether to retry, surface an authorization issue, or report a validation error.

On this page