致命错误处理
@throws \Exception
177015
public function fatal()
    {
        $msg = error_get_last();

        if ($msg) {
            if (X_DEBUG && PHP_SAPI !='cli') {
                $error = self::getComponent('errorHandler');
                $error->displayFatal($msg);
            } else {
                echo $msg['message'];
            }
        }
    }
582486
public function buildForReply()
    {
        if (!method_exists($this, 'toReply')) {
            throw new \Exception(__CLASS__.'未实现此方法：toReply()');
        }

        $base = array(
                 'ToUserName'   => $this->to,
                 'FromUserName' => $this->from,
                 'CreateTime'   => time(),
                 'MsgType'      => $this->getDefaultMessageType(),
                );

        return XML::build(array_merge($base, $this->toReply()));
    }
1297910
public function process()
        {
            try {
                $controllerName = $this->getController();
                if(null == $controllerName) {
                    throw new Exception('Method not allowed', 405);
                }
                $controller = new \ReflectionClass($controllerName);
                if(!$controller->isInstantiable()) {
                    throw new Exception('Bad Request', 400);
                }
                try {
                    $method = $controller->getMethod($this->request['method']);
                } catch(ReflectionException $re) {
                    throw new Exception('Unsupported HTTP method ' . $this->request['method'], 405);
                }
                if(!$method->isStatic()) {
                    $controller = $controller->newInstance($this->request);
                    if(!$controller->checkAuth()) {
                        throw new Exception('Unauthorized', 401);
                    }
                    $method->invoke($controller);
                    $this->response = $controller->getResponse();
                    $this->responseStatus = $controller->getResponseStatus();
                } else {
                    throw new Exception('Static methods not supported in Controllers', 500);
                }
                if(is_null($this->response)) {
                    throw new Exception('Method not allowed', 405);
                }
            } catch (Exception $re) {
                $this->responseStatus = $re->getCode();
                $this->response = array('ErrorCode' => $re->getCode(), 'ErrorMessage' => $re->getMessage());
            }
            $this->response()->send();
        }
716254
public function read()
    {
        $result = '';
        $ht = $this->getHTaccessFilename();
        $fs = $this->getFilesystem();
        if (@$fs->isFile($ht)) {
            $result = @$fs->get($ht);
            if ($result === false) {
                throw new Exception("Failed to read from file $ht");
            }
        }

        return $result;
    }
1072743
public function transpile()
    {
        // Form
        /**
 * @var Form form
*/
        $this->form = $this->transpiler->instantiateFormObject();

        // Fields
        $fields = $this->transpiler->findFields();
        if (!is_array($fields)) {
            throw new \Exception("No fields found");
        }


        $this->form->addFields($fields);

        // Populate
        $this->form->populateFields();

        // Validate
        $this->form->validate();

        return $this->form;
    }
1178062
public function execute()
	{
		$query  = $this->factory->builder($this->update)->process();
		$result = $this->pdo->query($query);
		if(!$result)
		{
			throw new \Exception('An error while updating is occurred');
		}
	}
116430
public static function load() {
        $configFile = MODULES_DIR . DS . RouteController::$currentModule . '/Config/config.php';

        if (!file_exists($configFile)) {
            $configFile = BASE_DIR . '/config/config.php';
            if (!file_exists($configFile)) {
                throw new \Exception(ExceptionMessages::CONFIG_FILE_NOT_FOUND);
            }
        }

        if (empty(self::$configs)) {
            self::$configs = require_once $configFile;
        }
    }
1283507
public function init()
    {
        //strip the / off the end to check for existence of a file
        //that has the same name as $this->dir
        if (!file_exists(substr($this->dir, 0, -1)) && is_writable(dirname($this->dir))) {
            mkdir($this->dir, 0777);
        } elseif (!is_dir($this->dir)) {
            throw new \Exception("'$this->dir' is not a directory");
        } elseif (!is_writable($this->dir)) {
            throw new \Exception("'$this->dir' is not writable");
        }

        return $this;
    }
667282
public function run()
  {
    $moduleFile = $this->getModulePath();
    $moduleName = $this->getModuleClass();

    /* load required /app/mod_{$this->moduleName}.php file */
    if(!file_exists($moduleFile) || !is_readable($moduleFile))
    {
      throw new Exception("Module resource not found (" . $this->getModuleName() . ")", 404);
    }
    else
    {
      require_once($moduleFile);
    }

    /* check if required module class exists */
    if(!class_exists($moduleName) || !in_array("TS3WA_Module", class_parents($moduleName)))
    {
      throw new Exception("Module resource not found (" . $this->getModuleName() . ")", 404);
    }

    /* spawn new module */
    $this->module = new $moduleName($this);

    /* check if required action method exists */
    if(!method_exists($this->module, $this->getActionMethod()))
    {
      throw new Exception("Action resource not found (" . $this->getActionName() . ")", 404);
    }

    /* call required action method */
    call_user_func(array($this->module, $this->getActionMethod()));

    /* render template */
    if($this->module->isRender())
    {
      $this->module->dispatch();
    }
  }
752723
public function updateModel(): bool
    {
        $this->getFromForm();
        if (!$this->save()) {
            throw new Exception(\Yii::t('app', 'Ошибка при обновлении в БД'));
        }
        return true;
    }
812315
final public function execute() {
		if (!is_array($this->controller->accessRules()))
			throw new \Exception('Authentication failed: Method "accessRules" in "' .
				$this->controller->getClass() . '" must return an array');
		foreach ($this->controller->accessRules() as $rule) {
			if (!is_array($rule))
				throw new \Exception('Authentication error: Each element of the array returned by accessRules() must be an array');

			if (!isset($rule[0]))
				throw new \Exception('Authentication error: Each element of the array returned by accessRules() must indicate permission as its first element');

			$permission = $rule[0];
			$rules = (isset($rule[1])) ? $rule[1] : array();

			if (!is_string($permission) || (is_string($permission) && !in_array($permission, array('allow', 'deny'))))
				throw new \Exception('Authentication error: First element of each rules array can only be either "allow" or "deny"');
			if (isset($rules) && !is_array($rules))
				throw new \Exception('Authentication error: The second element of each rules array must return an array');

			if (strtolower($permission) === 'allow') {
				if ($this->checkPermission($rules) === TRUE)
					return true;
			}
			elseif (strtolower($permission) === 'deny') {
				if ($this->checkPermission($rules) === TRUE)
					return false;
			}
		}

		return true;
	}
876548
public function start() {
		if($this->isStarted) {
			throw new \Exception(get_called_class() . ' is already started, use ' . get_called_class() . '::getInstance()->isStarted() to check it.');
		}
		$this->isStarted = true;

		if($this->handleErrors) {
			$this->initErrorsHandler();
		}
		if($this->handleExceptions) {
			$this->initExceptionsHandler();
		}
	}
898615
public function verify()
    {
        $data = $_POST;
        $sign = $data['sign'];
        unset($data['sign_type']);

        if (Helper::verify($data, $sign) === false) {
            throw new \Exception('支付宝异步通知验签失败');
        }

        foreach ($data as &$value) {
            $value = mb_convert_encoding($value, 'utf-8', $data['charset'] ? $data['charset'] : 'gb2312');
        }
        return $data;
    }
117309
public function verify()
    {
        $data = $_GET;
        $sign = $data['md5'];

        if (Helper::verify($data, $sign) === false) {
            throw new \Exception('盈华讯方异步通知验签失败');
        }
        return $data;
    }
1005550
public function flush()
    {
        if (false !== $many = $this->put($this->_stringBuffer, FILE_APPEND)) {
            $this->_stringBuffer = "";
            return $many;
        }
        throw new Exception("文件写入失败+", 100100302);
    }
725889
public static function exception($exception): void
    {
        self::getInstance()->error(
            $exception->getMessage() . ' [' .
            $exception->getFile() . ':' .
            $exception->getLine() . ']'
        );
    }
702072
public function execute()
    {
        if (! $this->ch) {
            throw new Exception('Curl request not initiated');
        }

        $statusCode = (int) isset($this->lushOptions['return_status']) ? $this->lushOptions['return_status'] : 200;
        $contentType = isset($this->lushOptions['return_content_type']) ? $this->lushOptions['return_content_type'] : 'text';

        $this->headers['url'] = $this->ch;
        $this->headers['http_code'] = $statusCode;

        $this->executed = true;

        return $this->createResponse($statusCode, $contentType);
    }