Use to log any controlled exception.

@param  \Exception   $exception
@return Exception5xx
777601
public function onAnyException(\Exception $exception)
    {
        $exception = FlattenException::create($exception);

        return $this->logException($exception, new Request());
    }
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);
        }
    }
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;
    }
882355
protected function getClass(\Exception $exception)
    {
        $message = '';

        if (($previous = $exception->getPrevious())) {
            $message = $this->getClass($previous) . ' < '; // Recurse
        }

        // Let the exception lie about its class: to support marshalling exceptions
        if (method_exists($exception, 'getClass')) {
            $message .= $exception->getClass();
        } else {
            $message .= get_class($exception);
        }

        return $message;
    }
1355730
protected function buildLogMessage(\Exception $exception)
    {
        $message = $exception->getMessage() . "({$exception->getCode()})";

        if ($exception instanceof PhprestException && $exception->getDetails()) {
            $message .= ' Details :: ' . json_encode($exception->getDetails());
        }

        $message .= ' Stack trace :: ' . $exception->getTraceAsString();

        return $message;
    }
1102825
public function record(Exception $e)
    {
        $this->exception = $e;
        return $this->recorder->record($e);
    }
836545
static function getTextForException(\Exception $exception) {
		// Now, let's compute the same message, but without the HTML markup for the error log.
		$textTrace = "Message: ".$exception->getMessage()."\n";
		$textTrace .= "File: ".$exception->getFile()."\n";
		$textTrace .= "Line: ".$exception->getLine()."\n";
		$textTrace .= "Stacktrace:\n";
		$textTrace .= self::getTextBackTrace($exception->getTrace());
		return $textTrace;
	}
712051
public function withException(\Exception $exception)
    {
        assert(!is_null($exception), 'Exception must not be null');

        return $this->withDetail('error', $exception->getMessage());
    }
1285722
public function PHPExceptionHandler($exception)
    {
        session_write_close();
        $message = $exception->getMessage() . ' | File: {file} | Ln: {line} | ST: {stacktrace}';
        $context = array(
            'file' => $exception->getFile(),
            'line' => $exception->getLine(),
            'stacktrace' => $exception->getTraceAsString()
        );
        $this->logger->log($this->exceptionLogLevel, $message, $context);
    }
1260024
public function exceptionHandler(Exception $exception)
    {
        $this->logger->addError($exception->getMessage(), array($exception->getFile(), $exception->getLine()));
        exit(-1);
    }
1105362
protected static function getFirstException(\Exception $exception)
    {
        if (null !== $exception->getPrevious()) {
            return static::getFirstException($exception->getPrevious());
        }

        return $exception;
    }
639434
static public function exceptionHandler($exception)
    {
        $msg = $exception->getMessage()
                . " Line "
                . $exception->getLine()
                . ", "
                . $exception->getFile();
        self::$logger->debug($msg);
    }
7201
public function exceptionHandler($exception)
  {
    # Set 500 error code as well as something unexpected happened
    $this->getResponse()->setStatusCode(500);

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

    # Output a response
    $this->getResponse()->send();
  }
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;
  }
1290047
public function setException(Exception $exception)
    {
        $this->exception = $exception;
        return $this->raiseStatus(self::Status_Exception);
    }
237094
public function logException($exception)
    {
        $category = get_class($exception);
        if ($exception instanceof HttpException) {
            $category = 'Zilf\\web\\HttpException:' . $exception->statusCode;
        } elseif ($exception instanceof \ErrorException) {
            $category .= ':' . $exception->getSeverity();
        }
        Zilf::error($exception, $category);
    }
715121
protected function logException(\Exception $exception)
    {
        $this->logger->error(
            $exception->getMessage(),
            array(
                'class'=>get_class($exception),
                'message'=>$exception->getMessage(),
                'file'=>$exception->getMessage(),
                'line'=>$exception->getMessage(),
                'command'=>$this->getName()
            )
        );
    }