Render the exception.

@param OutputInterface $output
@param \Exception      $e
335505
protected function renderException($output, \Exception $e)
    {
        $this->app[ExceptionHandler::class]->renderForConsole($output, $e);
    }
658888
public static function handler (\Exception $e) {
    try {
      $project = PSC::getProject();
    } catch (\Exception $noProjet) {
      $project = NULL;
    }
    
    $format = PHP_SAPI === 'cli' ? 'text' : 'html';
    
    $text = self::getExceptionText($e, $format, $project);
    
    print $text;
    
    PSC::getEnvironment()->getErrorHandler()->handleCaughtException($e);
  }
64344
public function writeException(Exception $e)
    {
        $class = get_class($e);
        $text = $this->adapter->colorize("Exception - $class:\n{$e->getMessage()}\n", ColorInterface::LIGHT_RED);

        if ($this->isVerbose()) {
            $text .= "\n" . $this->renderTrace($e->getTrace()) . "\n";

            if ($this->isVeryVerbose() && ($previous = $e->getPrevious())) {
                $text .= "\n" . $this->adapter->colorize('Previous Exceptions:', ColorInterface::YELLOW) . "\n\n";

                do {
                    $class = $this->adapter->colorize(get_class($previous), ColorInterface::YELLOW);
                    $msg = $this->adapter->colorize($previous->getMessage(), ColorInterface::GRAY);
                    $text .= sprintf('%s: %s', $class, $msg)
                           . "\n" . $this->renderTrace($e->getTrace()) . "\n\n";
                } while ($previous = $previous->getPrevious());
            }
        }

        $this->adapter->writeLine($text);
    }
725084
private function renderBeautifulExceptionView(\Throwable $e) {
		$request = N2N::getCurrentRequest();
		$response = N2N::getCurrentResponse();
		$status = null;
		$viewName = null;
		if ($e instanceof StatusException) {
			$status = $e->getStatus();
		} else {
			$status = Response::STATUS_500_INTERNAL_SERVER_ERROR;
		}
		
		$throwableModel = null;
// 		if ($e instanceof StatusException && isset($viewName)) {
// 			$throwableModel = new ThrowableModel($e, null);
// 		} else {
			$throwableModel = new ThrowableModel($e);
			$this->pendingOutputs[] = $response->fetchBufferedOutput(false);
			$that = $this;
			$throwableModel->setOutputCallback(function () use ($that) {
				$output = implode('', $this->pendingOutputs);
				$this->pendingOutputs = array();
				return $output;
			});
// 		}

		
		$viewName = N2N::getAppConfig()->error()->getErrorViewName($status);
			
		if ($viewName === null) {
			if (!N2N::isDevelopmentModeOn()) {
				$viewName = self::DEFAULT_STATUS_LIVE_VIEW;
			} else {
				if ($status == Response::STATUS_500_INTERNAL_SERVER_ERROR) {
					$viewName = self::DEFAULT_500_DEV_VIEW;
				} else {
					$viewName = self::DEFAULT_STATUS_DEV_VIEW;
				}
			}	
		}
		
		$view = N2N::getN2nContext()->lookup(ViewFactory::class)->create($viewName, array('throwableModel' => $throwableModel));
		$view->setControllerContext(new ControllerContext($request->getCmdPath(), $request->getCmdContextPath()));
		$response->reset();
		$response->setStatus($status);
		if ($e instanceof StatusException) {
			$e->prepareResponse($response);
		}
		$response->send($view);
	}
920663
protected function renderException($request, Exception $e)
    {
        return $this->app[ExceptionHandler::class]->render($request, $e);
    }
808666
protected function manageException(OutputInterface $output, Exception $e)
    {
        $handler = $this->getExceptionHandler();

        $handler->report($e);

        $handler->renderForConsole($output, $e);
    }
289753
public function error(\Exception $e)
    {
        if ($this->beep_on_error === true) {
            \Commando\Util\Terminal::beep();
        }

        if ($this->trap_errors !== true) {
            throw $e;
        }

        $color = new \Colors\Color();
        $error = sprintf('ERROR: %s ', $e->getMessage());
        echo $color($error)->bg('red')->bold()->white() . PHP_EOL;
        exit(1);
    }
469462
public function output( \Throwable $e )
    {
        list( $file, $line ) = Util::caller(0);

        $title = 'CharcoalPHP: Exception List';

        return $this->_output( $e, $title, $file, $line );
    }
651100
public function render( \Throwable $e )
    {
        list( $file, $line ) = Util::caller(0);

        $title = 'CharcoalPHP: Exception List';

        if ( $this->clear_buffer ){
            ob_clean();
        }

        echo $this->_output( $e, $title, $file, $line );
    }
1033710
public function render( $request, Exception $e )
	{
		$transformed = $this->getTransformed( $e );

		$response = method_exists( $e, 'getResponse' ) ? $e->getResponse() : null;

		if ( !$response instanceof Response )
			try
			{
				$response = $this->getResponse( $request, $e, $transformed );
			}
			catch ( Exception $e )
			{
				$this->report( $e );
				$response = new Response( 'Internal server error.', 500 );
			}

		return $this->toHttpResponse( $response, $transformed );
	}
202337
public function render($request, Exception $e)
    {
        $response = $this->exceptionHandler->render($request, $e);

        if ($this->shouldRenderException($response) === true) {
            $_SERVER = $request->server();
            $response->setContent(
                $this->debuggerManager->exceptionHandler($e)
            );
        }

        return $response;
    }
112396
public function render($e)
    {
        if ($e instanceof Throwable) {
            $e = $this->throwableToException($e);
        }
        
        if ($this->shouldntBacktrace($e)) {
            return with(new ExceptionHandler(env('APP_DEBUG')))->handle($e);
        }
        
        return with(new SymfonyExceptionHandler(env('APP_DEBUG')))->handle($e);
    }
14779
public function renderException($e, $output = null)
    {
        if ( ! $output) {
            $output = $this->output;

            if ($output instanceof ConsoleOutputInterface) {
                $output = $output->getErrorOutput();
            }
        }

        return parent::renderException($e, $output);
    }
649049
public function render($request, Exception $e)
    {
        if ($this->isHttpException($e)) {
            $code = $e->getStatusCode();

            if ($code !== 500 || App::environment('production') || App::environment('staging')) {
                $page = Page::findByInternalName($code);

                if ($page) {
                    $request = Request::create($page->url()->getLocation(), 'GET');

                    return response(Route::dispatch($request)->getContent(), $code);
                }
            }
        }

        return parent::render($request, $e);
    }
310726
public static function printException(\Exception $ex)
    {
        $msg="code:".$ex->getCode()
            ."\r\nmessage:".$ex->getMessage()
            ."\r\ntrace:".$ex->getTraceAsString();
        self::printLine($msg);
    }
1321105
public function handleException($e)
    {
        if (!$e instanceof Exception) {
            $e = new FatalThrowableError($e);
        }

        $this->getExceptionRenderer()->render($e, $this->debug());
    }
1188984
protected function renderExceptionWithSymfony(Exception $e, $debug)
    {
        return (new SymfonyExceptionHandler($debug))->getHtml(
            FlattenException::create($e)
        );
    }