protected function parseResponseInternal($response)
    {
        try {
            $result = $this->parseResponse($response);
            if (!isset($result)) {
                throw new ErrorException(Yii::t('eauth', 'Invalid response format.'), 500);
            }

            $error = $this->fetchResponseError($result);
            if (isset($error) && !empty($error['message'])) {
                throw new ErrorException($error['message'], $error['code']);
            }

            return $result;
        } catch (\Exception $e) {
            throw new ErrorException($e->getMessage(), $e->getCode());
        }
    }