Example #1
0
 /**
  * 设置错误管理器
  */
 protected function setError()
 {
     Exceptions\Exception::$app = $this;
     Exceptions\Exception::$errorReporting = $this->errorReporting();
     //接管错误和异常处理
     error_reporting($this->DEBUG);
     //注册系统默认异常处理函数
     //set_exception_handler(array($this, 'exceptionHandler'));
     set_exception_handler(function (\Exception $e) {
         throw new Exceptions\Exception($e->getMessage(), $e->getCode(), $e->getPrevious(), $e->getFile(), $e->getLine());
     });
     //注册系统默认错误处理函数
     //set_error_handler(array($this, 'errorHandler'), $this->DEBUG);
     set_error_handler(function ($code = 0, $message = '', $file = null, $line = null) {
         throw new Exceptions\Exception($message, $code, null, $file, $line);
     }, $this->DEBUG);
 }