@param \Exception $exception

@return int|null
435665
private function findStatusCode(\Exception $exception)
    {
        $exceptionClass = get_class($exception);

        foreach ($this->exceptionClassMap as $originalExceptionClass => $statusCode) {
            if ($exceptionClass === $originalExceptionClass || is_subclass_of($exceptionClass, $originalExceptionClass)) {
                return (int) $statusCode;
            }
        }

        return null;
    }
910927
public function setException(\Exception $exception = null)
    {
        $this->exception = $exception;
        $this->result = self::FAILED;
    }
711596
protected function exceptionHandler($exception)
    {
        switch (true) {
            case $exception instanceof RestException:
                $this->logger->notice($exception->getMessage(), $exception->getTrace());
                return $this->json($exception->getData(), $exception->getStatus());
            default:
                // TODO: Throw exception only in dev mode.
                throw $exception;
                $this->logger->error($exception->getMessage(), $exception->getTrace());
                return $this->json($exception->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
        }
    }
886013
protected function displayException($exception)
	{
		$displayer = $this->debug ? $this->debugDisplayer : $this->plainDisplayer;

		return $displayer->display($exception);
	}
850982
private function formatException(\Exception $exception)
    {
        $result = [
            'message' => $exception->getMessage(),
            'type'      => get_class($exception),
            'code'      => $exception->getCode(),
            'trace' => [
                [
                    'file' => $exception->getFile() ?: 'unknown',
                    'line' => $exception->getLine() ?: 'unknown',
                ]
            ]
        ];

        foreach ($exception->getTrace() as $frame) {
            $result['trace'][] = $this->formatStackFrame($frame);
        }

        if ($previous = $exception->getPrevious()) {
            $result['previous'] = $this->formatException($previous);
        }

        return $result;
    }
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;
  }
942685
protected function getDistalCause(\Exception $exception)
    {
        if (($previous = $exception->getPrevious())) {
            return $this->getDistalCause($previous);
        }
        return $exception;
    }
103517
protected function getTransformed( Exception $exception )
	{
		foreach ( $this->make( array_get( $this->getConfig(), 'transformers', [] ) ) as $transformer )
		{
			var_dump( $transformer );
			$exception = $transformer->transform( $exception );
		}

		return $exception;
	}
404087
public function isFirstParamClassPassTo($exception)
    {
        $params = $this->reflection->getParameters();
        if (0 === \count($params)) {
            return null;
        }

        if (null === $paramClassReflection = $params[0]->getClass()) {
            return null;
        }

        $paramClass = $paramClassReflection->getName();

        return $exception instanceof $paramClass;
    }
33468
private function getExceptionHandlerMethods(Exception $exception)
    {
        $class = new ReflectionClass($this);

        $handlerMethods = [];
        foreach ($class->getMethods(ReflectionMethod::IS_PROTECTED) as $method) {
            $param = current($method->getParameters());
            if ($param && $param->getClass() && $param->getClass()->isInstance($exception)) {
                $handlerMethods[] = $method;
            }
        }

        return $handlerMethods;
    }
143915
public function getErrorMessage($exception)
    {
        $application = $this->application;
        $errorHandler = $this->runner;

        // quit if error occured
        $shouldQuit = $application->isError();

        //
        if($application instanceof Application){
            // if request type ist not strict e.g. xml or json consider error config
            if (!$application->isXmlRequest() && !$application->isJsonRequest()) {
                $shouldQuit = $shouldQuit && $application->getConfig(ApplicationInterface::KEY_ERROR, ApplicationInterface::DEFAULT_ERROR);
            }
        }

        $errorHandler->allowQuit($shouldQuit);

        $method = $errorHandler::EXCEPTION_HANDLER;
        ob_start();
        $errorHandler->$method($exception);
        $message = ob_get_clean();

        return $message;
    }
455858
public function fromException( Exception $exception )
    {
        return $this->generateResponse(
            xmlrpc_encode_request(
                null,
                array(
                    'faultCode' => $exception->getCode(),
                    'faultString' => $exception->getMessage()
                )
            )
        );
    }
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);
    }
414030
protected function getExceptionStatusCode(Exception $exception, $defaultStatusCode = 500)
    {
        if ($exception instanceof ModelNotFoundException) {
            return 404;
        }

        return ($exception instanceof HttpExceptionInterface) ? $exception->getStatusCode() : $defaultStatusCode;
    }
91268
public function trackException(Exception $exception)
    {
        $id = $this->trackIfEnabled('errors', function () use ($exception) {
            $this->getErrorTracker()->track($exception);
        });

        $this->mergeVisitorActivityData(['error_id' => $id]);
    }
278240
protected function getStatusCode(\Exception $exception)
    {
        // If matched
        if ($statusCode = $this->exceptionCodes->resolveException($exception)) {
            return $statusCode;
        }

        // Otherwise, default
        if ($exception instanceof HttpExceptionInterface) {
            return $exception->getStatusCode();
        }

        return 500;
    }
1043083
protected function getErrorMessage(Exception $exception)
    {
        $defaultMessage =  __('Unexpected error. Please contact administrator');
        if (DEBUG_MODE) {
            $defaultMessage = $exception->getMessage();
        }
        return ($exception instanceof common_exception_UserReadableException) ? $exception->getUserMessage() :  $defaultMessage;
    }