Renders a caught exception.

@param \Exception      $e      An exception instance
@param OutputInterface $output An OutputInterface instance
14779
public function renderException($e, $output = null)
    {
        if ( ! $output) {
            $output = $this->output;

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

        return parent::renderException($e, $output);
    }
737887
public function renderForConsole($output, Exception $e)
    {
        if ($this->exceptionHandler !== null) {
            $this->exceptionHandler->renderForConsole($output, $e);
        }
    }
920663
protected function renderException($request, Exception $e)
    {
        return $this->app[ExceptionHandler::class]->render($request, $e);
    }
672746
public function render($request, Exception $e)
    {
        $transformed = $this->getTransformed($e);

        $response = $e instanceof Responsable ? $e->toResponse($request) : null;

        if (!$response && ($e instanceof OldHttpResponseException || $e instanceof NewHttpResponseException)) {
            $response = $e->getResponse();
        }

        if (!$response instanceof SymfonyResponse) {
            try {
                $response = $this->getResponse($request, $e, $transformed);
            } catch (Throwable $e) {
                $this->report($e instanceof Exception ? $e : new FatalThrowableError($e));

                $response = new Response('Internal server error.', 500, ['Content-Type' => 'text/plain']);
            }
        }

        return $this->toIlluminateResponse($response, $transformed);
    }
131375
protected function renderException($output, \Exception $e)
    {
        $this->laravel[ExceptionHandler::class]->renderForConsole($output, $e);
    }
814512
protected function handleError(Exception $e)
    {
        if($this->isCli){
            $errorCode = $e->getCode();
            exit((empty($errorCode)) ? 1 : $errorCode);	//exit the program with an error
        }
        else {
            throw new Exception($e->getMessage());
        }
    }
857724
public function report(Exception $e)
    {
        if ($this->shouldntReport($e)) {
            return;
        }

        try {
            if ($this->plugin->bound('bugsnag.multi')) {
                $logger = $this->plugin->make('bugsnag.multi');
            } else {            
                $logger = $this->plugin->make('Psr\Log\LoggerInterface');
            }
            $logger->error($e);

        } catch (Exception $ex) {
            throw $e; // throw the original exception
        } finally {
            $this->renderException($e);
        }
    }
1217015
protected function processError($output, $exceptionOnError = true, $exceptionClass = ShellException::class)
    {
        if ($exceptionOnError && $this->hadError()) {
            $exceptionClass = $exceptionClass ?: ShellException::class;
            throw new $exceptionClass($output);
        }

        return $this;
    }
617014
function exceptionHandler($e) {
        ob_get_clean();
        $this->exception_handler_called = true;

        if (!$this->level)
            return;

        if (is_object($e)) {
            $class   = 'Exception';
            $message = $e->getMessage();
            $file    = $this->limitPath($e->getFile());
            $line    = $e->getLine();
            $type    = '';
            $trace   = $e->getTrace();
        } else {
            $class = 'Error';
            extract($e);
            $type .= ' - ';
        }

        if ($this->terminal) {
            $c = $this->console;

            $c->writeln(' ', 'bg_light_red');
            $c->write(' ', 'bg_light_red');
            $c->writeln(' ' . $class . ': ' . $type . $message);
            $c->writeln(' ', 'bg_light_red');

            $c->writeln('file ' . $file . ', line: ' . $line , 'dark');
        } else {
            $body =
            '<div style="border-left:4px solid #d00; padding:6px;">' .
                '<div style="color:#d00">' . $class . ': ' . $type . $message . '</div><code style="color:#36c">file: ' .
                $file . ', line: ' . $line .
                '</code></div>';

            echo $body;
        }
        $this->_trace($trace);
    }
1296551
public function handleException( \Throwable $e ) : bool
    {
        try{
            // Render exception
            $output = $this->renderer->output( $e );
    
            // make directory
            $dir = $this->file->getParent();
    
            if (!$dir->exists()){
                $dir->makeDirectory();
            }
    
            // output
            $this->file->putContents($output);
        }
        catch(\Throwable $e){
            exit($e->getMessage());
        }
    
        return true;
    }
769737
public function report(Exception $e)
    {
        if ($this->shouldntReport($e)) {
            return;
        }

        if (method_exists($e, 'report')) {
            return $e->report();
        }

        try {
            $logger = $this->container->make(LoggerInterface::class);
        }
        catch (Exception $ex) {
            throw $e; // Throw the original exception
        }

        $logger->error($e);
    }
1186039
protected function renderException(RequestContract $request, Exception $e)
    {
        return $this->app[ExceptionHandlerContract::class]->render($request, $e);
    }
1161839
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $args = $this->prepareArgs($input->getArgument('exception'));
        $throwStmt = new Throw_(new StaticCall(new FullyQualifiedName(self::THROW_CLASS), 'fromThrowable', $args));
        $throwCode = $this->printer->prettyPrint([$throwStmt]);

        $shell = $this->getApplication();
        $shell->addCode($throwCode, !$shell->hasCode());
    }
852423
protected function writeError(OutputInterface $output, string $message)
    {
        if ($output instanceof ConsoleOutputInterface) {
            $output = $output->getErrorOutput();
        }

        $output->writeln($this->getHelper('formatter')->formatBlock($message, 'error'));
    }
907910
public function handleException(\Throwable $e, $display_mode = ErrorDisplayModes::CONSOLE)
    {
        switch($display_mode)
        {
            case ErrorDisplayModes::HTML:
                $renderer = new HtmlDebugtraceRenderer();
                break;

            case ErrorDisplayModes::CONSOLE:
            default:
                $renderer = new ConsoleDebugtraceRenderer();
                break;
        }
        (new PrintExceptionHandler($renderer))->handleException($e);
    }
1101553
protected function abortDueToException(Exception $e, InputInterface $input, OutputInterface $output)
    {
        $message = $e->getMessage();
        $code = $this->exceptionToErrorCode($e);

        if ($input->getOption('json')) {
            $response = [
                'ok' => false,
                'error_message' => $message,
                'error_code' => $code,
            ];

            if ($input->getOption('debug')) {
                $response['error_class'] = get_class($e);
                $response['error_file'] = $e->getFile();
                $response['error_line'] = $e->getLine();
                $response['error_trace'] = $e->getTraceAsString();
            }

            $output->writeln(json_encode($response));
        } else {
            if ($input->getOption('debug')) {
                $output->writeln('Jobs error: <'.get_class($e).'>'.$message.', in file '.$e->getFile().' on line '.$e->getLine());
                $output->writeln('');
                $output->writeln('Backtrace');
                $output->writeln('');
                $output->writeln($e->getTraceAsString());
            } else {
                $output->writeln('Jobs error: '.$message);
            }
        }

        return $code;
    }
546259
protected function renderException($request, Exception $e)
    {
        return $this->app[Handler::class]->render($request, $e);
    }