private function checkResult($result)
    {
        if ($this->debug) {
            if (in_array($this->format, [self::FORMAT_JSON, self::FORMAT_JSONP])) {
                $result = json_decode($result, true);
            } elseif ($this->format == self::FORMAT_SERIAL) {
                $result = unserialize($result);
            }

            if (is_array($result)) {
                if (isset($result['success']) && $result['success'] == 0 && isset($result['error'])) {
                    throw new \Exception($result['error']);
                }
            }
        }
    }