Returns the formatted message of a passed in exception.

@param  \Exception $e
@return string
339723
public static function getFormattedExceptionMessage(\Exception $e)
    {
        $name = static::getExceptionNameHierarchy($e);

        list($file, $line, $stackTrace) = static::getOriginalExceptionFileAndLineNumber($e);

        $message = "{$name}: {$e->getMessage()} ({$e->getcode()})\n{$file} {$line}\n{$stackTrace}";

        return $message;
    }
867985
protected function prepareException(Exception $e)
    {
        $e = parent::prepareException($e);

        if ($e instanceof MethodNotAllowedHttpException) {
            $e = new HttpException(405, 'Method not allowed', $e->getPrevious(), $e->getHeaders(), $e->getCode());
        }

        return $e;
    }
237774
protected function getMessage(Exception $e)
    {
        return $e->getMessage().' (View: '.realpath(Arr::last($this->lastCompiled)).')';
    }
172636
protected function convertExceptionToArray(Exception $e)
    {
        return config('app.debug') ? [
            'message' => $e->getMessage(),
            'exception' => get_class($e),
            'file' => $e->getFile(),
            'line' => $e->getLine(),
            'trace' => collect($e->getTrace())->map(function ($trace) {
                return Arr::except($trace, ['args']);
            })->all(),
        ] : [
            'message' => $this->isHttpException($e) ? $e->getMessage() : 'Server Error',
        ];
    }
1350750
protected function getGeneralErrorMessage(\Exception $caught)
    {
        $singleName = $this->getEntityNameSingular();
        $message = "There was an error when saving {$singleName} data: %s";
        return sprintf($this->translate($message), $caught->getMessage());
    }
941584
public function fromException(\Exception $e)
    {
        return new Error(E_EXCEPTION, $e->__toString(), $e->getFile(), $e->getLine(), $e->getCode());
    }
506024
public static function exception_handler(\Exception $e)
	{
		if (method_exists($e, 'handle'))
		{
			return $e->handle();
		}

		$severity = ( ! isset(static::$levels[$e->getCode()])) ? $e->getCode() : static::$levels[$e->getCode()];
		logger(\Fuel::L_ERROR, $severity.' - '.$e->getMessage().' in '.$e->getFile().' on line '.$e->getLine());

		if (\Fuel::$env != \Fuel::PRODUCTION)
		{
			static::show_php_error($e);
		}
		else
		{
			static::show_production_error($e);
		}
	}
615633
private function eventMsg(\Exception $exception)
    {
        return sprintf('%s (%s line:%s)', $exception->getMessage(), $exception->getFile(), $exception->getLine());
    }
808489
protected function convertExceptionToResponse(Exception $e)
    {
        $e = FlattenException::create($e);
        $handler = new SymfonyExceptionHandler(DEBUG);
        echo $handler->getHtml($e);
    }
992992
protected function handleGenericException(Exception $e)
    {
        // Get the status code and build the message.
        $statusCode = 500;
        $message = $e->getMessage();

        return $this->generateResponse('', null, $statusCode, Status::FAIL, $message);
    }
452175
protected function getFullExceptionMessage(\Exception $e)
    {
        $message = $e->getMessage();
        if (is_a($e, '\eZ\Publish\API\Repository\Exceptions\ContentTypeFieldDefinitionValidationException') ||
            is_a($e, '\eZ\Publish\API\Repository\Exceptions\LimitationValidationException') ||
            is_a($e, '\eZ\Publish\Core\Base\Exceptions\ContentFieldValidationException')
        ) {
            if (is_a($e, '\eZ\Publish\API\Repository\Exceptions\LimitationValidationException')) {
                $errorsArray = $e->getLimitationErrors();
                if ($errorsArray == null) {
                    return $message;
                }
            } else if (is_a($e, '\eZ\Publish\Core\Base\Exceptions\ContentFieldValidationException')) {
                $errorsArray = array();
                foreach ($e->getFieldErrors() as $limitationError) {
                    // we get the 1st language
                    $errorsArray[] = reset($limitationError);
                }
            } else {
                $errorsArray = $e->getFieldErrors();
            }

            foreach ($errorsArray as $errors) {
                // sometimes error arrays are 2-level deep, sometimes 1...
                if (!is_array($errors)) {
                    $errors = array($errors);
                }
                foreach ($errors as $error) {
                    /// @todo find out what is the proper eZ way of getting a translated message for these errors
                    $translatableMessage = $error->getTranslatableMessage();
                    if (is_a($translatableMessage, '\eZ\Publish\API\Repository\Values\Translation\Plural')) {
                        $msgText = $translatableMessage->plural;
                    } else {
                        $msgText = $translatableMessage->message;
                    }

                    $message .= "\n" . $msgText . " - " . var_export($translatableMessage->values, true);
                }
            }
        }

        while (($e = $e->getPrevious()) != null) {
            $message .= "\n" . $e->getMessage();
        }

        return $message;
    }
273036
private static function _formatException($exception)
    {
        return str_replace(realpath(BASE_PATH), '', \Mmi\App\FrontController::getInstance()->getEnvironment()->requestUri . ' (' . $exception->getMessage() . ') @' .
            $exception->getFile() . '(' . $exception->getLine() . ') ' .
            self::_formatTrace($exception));
    }
173233
protected function handleModelNotFoundException(Exception $e)
    {
        // Get the status code and build the message.
        $statusCode = 404;
        $reflection = new \ReflectionClass($e->getModel());
        $message = $reflection->getShortName() . ' not found';

        return $this->generateResponse('', null, $statusCode, Status::FAIL, $message);
    }
1318577
private function formatExceptionStacktrace($exception)
    {
        if (!$exception instanceof Throwable) {
            return '';
        }

        $trace = $this->formatStacktraceEntry('ERR', [
            'function' => $exception->getMessage(),
            'file' => $exception->getFile(),
            'line' => $exception->getLine(),
        ]);

        if (!$this->logStacktraces) {
            return $trace;
        }

        foreach ($exception->getTrace() as $index => $entry) {
            $trace .= $this->formatStacktraceEntry(sprintf('#%d', $index), $entry);
        }

        return $trace;
    }
196912
private function handleException(\Exception $e)
    {
        trigger_error($e->getMessage() . "\n" . $e->getTraceAsString(), E_USER_WARNING);
        if ($e instanceof Error) {
            return '<strong>' . $e->getRawMessage() . '</strong>';
        }

        return '';
    }
911614
private function wrapException(\Exception $e)
    {
        if ($e instanceof ClientException && $e->getResponse()->getStatusCode() == 404) {
            return NotFoundException::wrap($e);
        }

        return ErrorException::wrap($e);
    }
560597
private function translateExceptionCode($e)
    {
        if (! in_array($e->getCode(), [0, -1, null, ''])) {
            return $e->getCode();
        }

        if (method_exists($e, 'getStatusCode')) {
            if (! in_array($e->getStatusCode(), [0, -1, null, ''])) {
                return $e->getStatusCode();
            }

            if (($statusCode = $this->getStatusCode()) != StatusCode::OK) {
                return $statusCode;
            }
        }

        if ($e instanceof \Illuminate\Database\Eloquent\ModelNotFoundException
            or $e instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
        ) {
            return StatusCode::NOT_FOUND;
        }

        return StatusCode::BAD_REQUEST;
    }