src/Protocol/Http/ExceptionFactory/ExceptionFactory.php
public function create(Response $response): SendNotificationException
    {
        $content = $response->getContent();

        if (!$content) {
            return new MissingContentInResponseException();
        }

        $json = json_decode($content, true);

        if (null === $json) {
            return new InvalidResponseException(sprintf(
                'Can not parse JSON in response. Error: %d - %s',
                json_last_error(),
                json_last_error_msg()
            ));
        }

        if (!array_key_exists('reason', $json)) {
            return new MissingErrorReasonInResponseException();
        }

        $reason = $json['reason'];

        return $this->createByReason($reason, $json);
    }
public function create(Response $response): SendNotificationException
    {
        $content = $response->getContent();

        if (!$content) {
            return new MissingContentInResponseException();
        }

        $json = json_decode($content, true);

        if (null === $json) {
            return new InvalidResponseException(sprintf(
                'Can not parse JSON in response. Error: %d - %s',
                json_last_error(),
                json_last_error_msg()
            ));
        }

        if (!array_key_exists('reason', $json)) {
            return new MissingErrorReasonInResponseException();
        }

        $reason = $json['reason'];

        return $this->createByReason($reason, $json);
    }
{@inheritdoc}