Display the given exception to the user.

@param   object  $exception
@return  void
177137
public function render($error)
	{
		if (!headers_sent())
		{
			header('HTTP/1.1 500 Internal Server Error');
		}

		$response = 'Error: ' . $error->getCode() . ' - ' . $error->getMessage() . "\n\n";

		if ($this->debug)
		{
			$backtrace = $error->getTrace();

			if (is_array($backtrace))
			{
				$backtrace = array_reverse($backtrace);

				for ($i = count($backtrace) - 1; $i >= 0; $i--)
				{
					if (isset($backtrace[$i]['class']))
					{
						$response .= "\n[$i] " . sprintf("%s %s %s()", $backtrace[$i]['class'], $backtrace[$i]['type'], $backtrace[$i]['function']);
					}
					else
					{
						$response .= "\n[$i] " . sprintf("%s()", $backtrace[$i]['function']);
					}

					if (isset($backtrace[$i]['file']))
					{
						$response .= sprintf(' @ %s:%d', str_replace(PATH_ROOT, '', $backtrace[$i]['file']), $backtrace[$i]['line']);
					}
				}
			}
		}

		echo (php_sapi_name() == 'cli') ? $response : nl2br($response);

		exit();
	}
612412
public function logException(\Exception $exception)
    {
        $this->logError('Error: ' . get_class($exception) . ' - ' . $exception->getMessage() . ' (Code: ' . $exception->getCode() . ')');
        $this->logError('File: ' . $exception->getFile() . ' / Line: ' . $exception->getLine());
    }
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);
        }
    }
1205450
public function dispatchException($exception) {
		if($this->isActive()) {
			if($this->dispatchPreviousExceptions && $exception->getPrevious()) {
				$this->dispatchException($exception->getPrevious());
			}
			$message = new ErrorMessage();
			$message->code = $exception->getCode();
			$message->class = get_class($exception);
			$message->data = $this->dumper->dump($exception->getMessage());
			$message->file = $exception->getFile();
			$message->line = $exception->getLine();
			$message->trace = self::fetchTrace($exception->getTrace(), $message->file, $message->line);
			$this->sendMessage($message);
		}
	}
436119
protected function echoExceptionWeb($exception)
    {
        $statusCode = ($exception instanceof WithHttpStatusInterface) ? $exception->getStatusCode() : 500;
        $statusMessage = ResponseInformationHelper::getStatusMessageByCode($statusCode);
        $referenceCode = ($exception instanceof WithReferenceCodeInterface) ? $exception->getReferenceCode() : null;
        if (!headers_sent()) {
            header(sprintf('HTTP/1.1 %s %s', $statusCode, $statusMessage));
        }

        try {
            if (isset($this->renderingOptions['templatePathAndFilename'])) {
                try {
                    echo $this->buildView($exception, $this->renderingOptions)->render();
                } catch (\Throwable $throwable) {
                    $this->renderStatically($statusCode, $throwable);
                }
            } else {
                echo $this->renderStatically($statusCode, $referenceCode);
            }
        } catch (\Exception $innerException) {
            $message = $this->throwableStorage->logThrowable($innerException);
            $this->logger->critical($message);
        }
    }
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);
    }
959828
function logexception(\Exception $exception) {
		try {
			$message = $exception->getMessage();
			$trace = $exception->getTraceAsString();
			$trace = $this->becloud($trace);
			$trace = str_replace("\n", "\n\t", trim($trace, " \n\r\t"));
			$this->log("$message\n\n\t$trace\n");
		}
		catch (\Exception $e) {
			$this->failedLogging($e, $exception->getMessage());
		}
	}
1078728
public function wrapAndHandleException($exception)
    {
        if ($exception instanceof Error) {
            $exception = new Exception($exception);
        }

        $this->handleException($exception);
    }
1182574
public function handleException(Exception $exception)
    {
        $severity = method_exists($exception, 'getSeverity') ? $exception->getSeverity() : self::ERROR_LEVEL;
        self::singleton()
            ->log(
                $severity,
                $exception->getMessage(),
                [
                    self::CONTEXT_EXCEPTION => get_class($exception),
                    self::CONTEXT_ERROR_FILE => $exception->getFile(),
                    self::CONTEXT_ERROR_LINE => $exception->getLine(),
                    self::CONTEXT_TRACE => $exception->getTrace()
                ]
            );
    }
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());
        }
    }
554604
protected function log(\Exception $exception)
    {
        if (null !== $this->logger) {
            $message = sprintf(
                '%s: %s (uncaught exception) at %s line %s',
                get_class($exception),
                $exception->getMessage(),
                $exception->getFile(),
                $exception->getLine()
            );

            $this->logger->error($message, array('exception' => $exception));
        }
    }
25937
protected function echoExceptionWeb($exception)
    {
        $statusCode = ($exception instanceof WithHttpStatusInterface) ? $exception->getStatusCode() : 500;
        $statusMessage = ResponseInformationHelper::getStatusMessageByCode($statusCode);
        if (!headers_sent()) {
            header(sprintf('HTTP/1.1 %s %s', $statusCode, $statusMessage));
        }

        if (!isset($this->renderingOptions['templatePathAndFilename'])) {
            $this->renderStatically($statusCode, $exception);
            return;
        }

        try {
            echo $this->buildView($exception, $this->renderingOptions)->render();
        } catch (\Throwable $throwable) {
            $this->renderStatically($statusCode, $throwable);
        }
    }
1152801
public function drawException($exception) {
        $this->w = 1;
        $this->h = 1;
        $this->init();

        // Is the image big enough?
        $w = imagesx($this->im);
        $h = imagesy($this->im);

        $text = 'Error: ' . $exception->getMessage();

        $width = imagefontwidth(2) * strlen($text);
        $height = imagefontheight(2);
        if ($width > $w || $height > $h) {
            $width = max($w, $width);
            $height = max($h, $height);

            // We change the size of the image
            $newimg = imagecreatetruecolor($width, $height);
            imagefill($newimg, 0, 0, imagecolorat($this->im, 0, 0));
            imagecopy($newimg, $this->im, 0, 0, 0, 0, $w, $h);
            $this->im = $newimg;
        }

        $black = new CINColor('black');
        imagestring($this->im, 2, 0, 0, $text, $black->allocate($this->im));
    }
1347437
public function report(Exception $exception)
    {
        $enableEmailExceptions = config('exceptions.emailExceptionEnabled');

        if ($enableEmailExceptions === '') {
            $enableEmailExceptions = config('exceptions.emailExceptionEnabledDefault');
        }

        if ($enableEmailExceptions) {
            if ($this->shouldReport($exception)) {
                $this->sendEmail($exception);
            }
        }

        parent::report($exception);
    }
610869
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->captureException($exception);
        }
    }
1135885
protected function renderException($exception)
    {
        $contentType = static::getContentType();
        $dataType = explode('/', $contentType);
        $dataType = isset($dataType[1]) ? $dataType[1] : 'text';

        switch ($dataType) {
            case 'json':
                $output = $this->getJsonMessage($exception);
                break;
                
            case 'xml':
                $output = $this->getXmlMessage($exception);
                break;
            
            case 'html':
                $output = $this->getHtmlMessage($exception);
                break;
                
            case 'text':
            default:
                $output = $this->getTextMessage($exception);
        }
        
        echo $output;
    }
1036917
public function displayException($exception,$custom='')
    {
        $data = array();
        $data['code'] = $exception->getCode();
        $data['message'] = $exception->getMessage()." ( {$custom} )";
        $data['file'] = $exception->getFile();
        $data['line'] = $exception->getLine();
        $data['type'] = get_class($exception);
        $trace = $exception->getTrace();
        $data = $this->_formatError($trace, $data);
        $this->render('error', $data);
    }