lib/Mailer/SparkPost.php
protected function handle(ResponseInterface $response)
    {
        $httpException = new HttpException($response->getStatusCode(), $response->getReasonPhrase());

        // 400-429 will contain error information in the body encoded as JSON
        if ($response->getStatusCode() >= 400 && $response->getStatusCode() <= 429) {
            throw new ApiException((string) $response->getBody(), $httpException);
        }

        throw $httpException;
    }
protected function handle(ResponseInterface $response)
    {
        $httpException = new HttpException($response->getStatusCode(), $response->getReasonPhrase());

        // 400-429 will contain error information in the body encoded as JSON
        if ($response->getStatusCode() >= 400 && $response->getStatusCode() <= 429) {
            throw new ApiException((string) $response->getBody(), $httpException);
        }

        throw $httpException;
    }
{@inheritdoc}

HTTP codes 400-429 will throw an ApiException, otherwise an HttpException is thrown.