Handles uncaught exceptions
@param  mixed       $exception
@return string|void
557364
public function exceptionHandler($exception)
    {
        $context = array(
            'file'    => $exception->getFile(),
            'line'    => $exception->getLine()
        );

        if ($this->reportBacktrace) {
            $context['backtrace'] = $this->getBacktraceReporter()->getBacktrace($exception);
        }

        if ($this->exceptionInContext) {
            $context['exception'] = $exception;
        }

        $this->logger->error(
            $message = 'Uncaught ' . get_class($exception) . ': ' . $exception->getMessage(),
            $context
        );

        // Exceptions must be reported in general because they stop the regular display of the page
        if ($this->showErrors || $this->getEnvReporter()->isLive()) {
            $this->getErrorReporter()->reportError($exception);
        }
    }
1098955
public function handleException($exception)
    {
        if ($exception instanceof ExitException) {
            return;
        }

        $this->exception = $exception;

        // disable error capturing to avoid recursive errors while handling exceptions
        $this->unregister();

        // set preventive HTTP status code to 500 in case error handling somehow fails and headers are sent
        // HTTP exceptions will override this value in renderException()
        if (PHP_SAPI !== 'cli') {
            http_response_code(500);
        }

        try {
            $this->logException($exception);
            if ($this->discardExistingOutput) {
                $this->clearOutput();
            }
            $this->renderException($exception);
            if (!YII_ENV_TEST) {
                $this->profiler->flush();
                $this->flushLogger();
                exit(1);
            }
        } catch (\Throwable $e) {
            // another exception could be thrown while displaying the exception
            $this->handleFallbackExceptionMessage($e, $exception);
        }

        $this->exception = null;
    }
251360
final protected function handleErrors($exception = null)
    {
        $errorInfo = [
            'code' => 0,
            'message' => null,
            'file' => null,
            'line' => null,
            'trace' => null,
            'exception' => null,
        ];
        if ($exception instanceof \Throwable ||
            $exception instanceof \Exception
        ) {
            $errorInfo['code'] = $exception->getCode();
            $errorInfo['message'] = $exception->getMessage();
            $errorInfo['file'] = $exception->getFile();
            $errorInfo['line'] = $exception->getLine();
            $errorInfo['trace'] = $exception->getTrace();
            $errorInfo['exception'] = $exception;
        } else {
            $last_error = error_get_last();
            if (!empty($last_error['message'])) {
                $errorInfo['message'] = $last_error['message'];
            }
            if (!empty($last_error['file'])) {
                $errorInfo['file'] = $last_error['file'];
            }
            if (!empty($last_error['line'])) {
                $errorInfo['line'] = $last_error['line'];
            }
        }
        if (!empty($errorInfo['message'])) {
            return $this->halt($errorInfo);
        }
        return false;
    }
1118223
public function handle(Exception $exception)
    {
        try {

            $handlers = array_filter($this->handlers, function ($handler) use ($exception) {
                return $exception instanceof $handler[0];
            });

            foreach ($handlers as $handler) {
                $error = $handler[1]($exception);

                if ($error !== null) {
                    break;
                }
            }

        } catch (Exception $e) {

            echo sprintf('[%d] %s in %s', $e->getLine(), $e->getMessage(), $e->getFile());
        }
    }
647957
public function handleException($exception)
    {
    	if ($exception instanceof ExitException) {
    		return;
    	}
    	
    	$this->exception = $exception;
    	
    	// disable error capturing to avoid recursive errors while handling exceptions
    	$this->unregister();
    	
    	try {
    		// 记录日志
    		$this->logException($exception);
    		
    		if ($this->options['discard_output']) {
    			$this->clearOutput();
    		}
    		
    		// 显示错误信息
    		$this->renderException($exception);
    		
    	} catch (\Exception $e) {
    		// an other exception could be thrown while displaying the exception
    		$msg = (string) $e;
    		$msg .= "\nPrevious exception:\n";
    		$msg .= (string) $exception;
    		$msg .= "\n\$_SERVER = " . var_export($_SERVER, true);
    		
    		error_log($msg);
    		exit(1);
    	}
    	
    	$this->exception = null;
    }
356869
protected function logException(\Exception $exception)
    {
        $level = $this->getLogLevel();
        
        $message = sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(),
            $exception->getFile(), $exception->getLine());
        
        $context = compact('exception');

        $this->getLogger()->log($level, $message, $context);
    }
724181
public function handleExceptions($exception)
    {
        $this->displayError($exception);
        $this->sendErrorNotification($exception);

        if(isset($this->ApplicationContext) && ($this->ApplicationContext->isOneOffRedeploy() || $this->redeployOnError))
            $this->ApplicationContext->clearContextFiles();
    }
840325
public static function handleException($exception)
    {
        $message = get_class($exception) . " " . $exception->getCode() . ":\n\n" . $exception->getMessage() . "\n" .
            self::exception_get_dev_message($exception) . " in " .
            $exception->getFile() . " on line " . $exception->getLine() . ".\n\n Backtrace: " . $exception->getTraceAsString();

        $currentPreviousException = $exception;
        while ($currentPreviousException = $currentPreviousException->getPrevious()) {
            $message .= "\nPrevious: " . get_class($currentPreviousException) . " " . $currentPreviousException->getMessage() . "\n" . self::exception_get_dev_message($currentPreviousException) . "\n in "
                . $currentPreviousException->getFile() . " on line " . $currentPreviousException->getLine() . ".\n" . $currentPreviousException->getTraceAsString();
        }

        if (self::isDeveloperPresentable($exception)) {
            $uri = isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : (isset($_SERVER["argv"]) ? implode(" ", $_SERVER["argv"]) : null);

            Logger::log($message, Logger::LOG_LEVEL_ERROR);

            $debugMsg = $message . "\n\n\n" . "URL: " . $uri . " \nPOST: ".print_r($_POST, true).
                "GET: " . print_r($_GET, true) .
                "SERVER: " . print_r($_SERVER, true) .
                "HTTP: " . print_r(getallheaders(), true) .
                "\nComposer: " . print_r(GomaENV::getProjectLevelComposerArray(), true) .
                " Installed: " . print_r(GomaENV::getProjectLevelInstalledComposerArray(), true) . "\n\n";
            Logger::log($debugMsg, Logger::LOG_LEVEL_DEBUG);
        } else {
            Logger::log($message, Logger::LOG_LEVEL_LOG);
        }
    }
186956
public function handleException($exception)
  {
    // Disable error capturing to avoid recursive errors while handling exceptions.
    $this->unregister();

    try
    {
      $this->clearOutput();
      $this->renderException($exception);

      exit(-1);
    }
    catch (\Exception $e)
    {
      // Another exception could be thrown while displaying the exception.
      $message = "An Error occurred while handling another error:\n";
      $message .= (string)$e;
      $message .= "\nPrevious exception:\n";
      $message .= (string)$exception;
      if ($this->myDebug)
      {
        $this->echoMessage($message);
      }
      else
      {
        $this->echoMessage('An internal server error occurred.');
      }
      $message .= "\n\$_SERVER = ".print_r($_SERVER, true);
      error_log($message);

      exit(1);
    }
  }
179575
public function handle($exception)
    {
        $handlers = (array)$this->config('handlers');
        foreach ($handlers as $handler => $config) {
            $handlerClass = $handler;
            if (!class_exists($handlerClass)) {
                $handlerClass = 'Josegonzalez\ErrorHandlers\Handler\\' . $handler;
            }
            if (!class_exists($handlerClass)) {
                $handlerClass = 'Josegonzalez\ErrorHandlers\Handler\\' . $handler . 'Handler';
            }
            if (!class_exists($handlerClass)) {
                continue;
            }
            $instance = new $handlerClass((array)$config);
            $instance->handle($exception);
        }

        return false;
    }
807009
protected function _handleSystemException($exception)
    {
        \OxidEsales\Eshop\Core\Registry::getLogger()->error($exception->getMessage(), [$exception]);

        if ($this->_isDebugMode()) {
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($exception);
            $this->_process('exceptionError', 'displayExceptionError');
        } else {
            \OxidEsales\Eshop\Core\Registry::getUtils()->redirect(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopHomeUrl() . 'cl=start', true, 302);
        }
    }
1243341
public function handle($exception)
    {
        $exception = call_user_func($this->config('exceptionCallback'), $exception);
        if (!$exception) {
            return;
        }
        $client = $this->client();
        $client = call_user_func($this->config('clientCallback'), $client);
        if ($client) {
            $client->SendException($exception);
        }
    }
1272392
public function handle($exception)
    {
        $handlers = (array)Configure::read('Error.config.handlers');
        foreach ($handlers as $handler => $config) {
            $handlerClass = $handler;
            if (!class_exists($handlerClass)) {
                $handlerClass = 'Josegonzalez\ErrorHandlers\Handler\\' . $handler;
            }
            if (!class_exists($handlerClass)) {
                $handlerClass = 'Josegonzalez\ErrorHandlers\Handler\\' . $handler . 'Handler';
            }
            if (!class_exists($handlerClass)) {
                continue;
            }
            $instance = new $handlerClass((array)$config);
            $instance->handle($exception);
        }
    }
725889
public static function exception($exception): void
    {
        self::getInstance()->error(
            $exception->getMessage() . ' [' .
            $exception->getFile() . ':' .
            $exception->getLine() . ']'
        );
    }
290322
public function exceptionHandler($exception)
  {
    if (!\is_null($this->getResponse())) {
      # Run the Error Controller
      $response = $this->runErrorController('',500);

      # Set the error response
      $this->setResponse($response);
    } else {
      # Set HTTP Response Code - we dont even have a response object yet ..
      \http_response_code(500);

    }

    # Log the exception
    $this->getLogger()
         ->critical(
            $exception->getMessage().' in file '.$exception->getFile().' on line '.$exception->getLine(),
            $exception->getTrace()
          );

    return null;
  }
1247108
public function catchException($exception)
    {
        if (in_array(get_class($exception), $this->config->getExcludeExceptions())) {
            return;
        }

        try {
            $this->send(
                Formatter::make($exception, $this->config)->toArray()
            );
        } catch (Exception $exception) {
            error_log('AfterBug Error: Couldn\'t notify. '.$exception->getMessage());
        }
    }
49400
protected function handleException($exception)
	{
		$app=Yii::app();
		if($app instanceof CWebApplication)
		{
			if(($trace=$this->getExactTrace($exception))===null)
			{
				$fileName=$exception->getFile();
				$errorLine=$exception->getLine();
			}
			else
			{
				$fileName=$trace['file'];
				$errorLine=$trace['line'];
			}

			$trace = $exception->getTrace();

			foreach($trace as $i=>$t)
			{
				if(!isset($t['file']))
					$trace[$i]['file']='unknown';

				if(!isset($t['line']))
					$trace[$i]['line']=0;

				if(!isset($t['function']))
					$trace[$i]['function']='unknown';

				unset($trace[$i]['object']);
			}

			$this->_exception=$exception;
			$this->_error=$data=array(
				'code'=>($exception instanceof CHttpException)?$exception->statusCode:500,
				'type'=>get_class($exception),
				'errorCode'=>$exception->getCode(),
				'message'=>$exception->getMessage(),
				'file'=>$fileName,
				'line'=>$errorLine,
				'trace'=>$exception->getTraceAsString(),
				'traces'=>$trace,
			);

			if(!headers_sent())
			{
				$httpVersion=Yii::app()->request->getHttpVersion();
				header("HTTP/$httpVersion {$data['code']} ".$this->getHttpHeader($data['code'], get_class($exception)));
			}

			$this->renderException();
		}
		else
			$app->displayException($exception);
	}