Generate the error log message.

@param \Psr\Http\Message\ServerRequestInterface $request The current request.
@param \Exception $exception The exception to log a message for.

@return string Error message
761849
protected function _getLogMessage($request, $exception)
    {
        $message = sprintf(
            '[%s] %s',
            get_class($exception),
            $exception->getMessage()
        );

        $message .= "\nRequest URL: " . $request->getRequestTarget();

        $referer = $request->getHeaderLine('Referer');
        if ($referer) {
            $message .= "\nReferer URL: " . $referer;
        }

        if ($exception instanceof InvalidResponse && $exception->getResponse()) {
            $message .= "\nProvider Response: " . $exception->getResponse()->getBody();
        }

        $message .= "\nStack Trace:\n" . $exception->getTraceAsString() . "\n\n";

        return $message;
    }
1309035
private function getMessage(\Exception $exception)
    {
        $message = $exception->getMessage();

        if ($this->isApiException($exception)) {
            $message = $exception->getMessageWithVariables();
        }

        return $message;
    }
1152121
public function formatException(Exception $exception)
    {
        if ($exception instanceof HttpException) {
            return $this->formatter->formatResponse($exception->getResponse());
        }

        if ($exception instanceof TransferException || $exception instanceof NetworkExceptionInterface) {
            return sprintf('Transfer error: %s', $exception->getMessage());
        }

        return sprintf('Unexpected exception of type "%s": %s', get_class($exception), $exception->getMessage());
    }
45173
public static function errorLog(string $message, \Exception $exception)
    {
        $logger = Config::getLogger();
        if ($logger) {
            $logger->error($message, ['exception' => $exception]);
        }
    }
183013
private function logException(Exception $exception): void
    {
        if ($exception instanceof HttpExceptionInterface && $exception->getStatusCode() < 500) {
            return;
        }

        $this->logger->critical(
            sprintf(
                'Uncaught PHP Exception %s: "%s" at %s line %s',
                get_class($exception),
                $exception->getMessage(),
                $exception->getFile(),
                $exception->getLine()
            ),
            ['exception' => $exception]
        );
    }
940614
public function logException(Exception $exception, $message = null)
    {
        $msg = $exception->getMessage();
        if ($message != null) {
            $msg = "Message: " . $message . " Exception: " . $msg;
        }
        $this->doLog(LogHelper::LOG_LEVEL_FATAL, $msg, null);
    }
1194113
protected function toDebugResponse( RequestInterface $request, PhpException $exception ) {
		if ( $request->isAjax() ) {
			return Response::json( [
				'message' => $exception->getMessage(),
				'exception' => get_class( $exception ),
				'file' => $exception->getFile(),
				'line' => $exception->getLine(),
				'trace' => array_map( function ( $trace ) {
					return Arr::except( $trace, ['args'] );
				}, $exception->getTrace() ),
			] )->withStatus( 500 );
		}

		if ( $this->whoops !== null ) {
			return $this->toPrettyErrorResponse( $exception );
		}

		throw $exception;
	}
856773
public function handleException(ServerRequestInterface $request, ResponseInterface $response, Exception $exception)
    {
        if ($level = $this->shouldLog('error')) {
            $this->logError($exception, $level);
        }

        return $this->handler->handleException($request, $response, $exception);
    }
900745
protected function logException(\Exception $exception)
    {
        try {
            $this->logger->error($exception->getMessage() , array('exception' => $exception));
        } catch (\Exception $exception) {
            trigger_error("Error logging Monitor exception: ".$exception->getMessage());
        }
    }
733154
protected function _displayException($exception)
    {
        $errorName = 'Exception:';
        if ($exception instanceof FatalErrorException) {
            $errorName = 'Fatal Error:';
        }

        if ($exception instanceof PHP7ErrorException) {
            $exception = $exception->getError();
        }

        $message = sprintf(
            '<error>%s</error> %s in [%s, line %s]',
            $errorName,
            $exception->getMessage(),
            $exception->getFile(),
            $exception->getLine()
        );
        $this->_stderr->write($message);
    }
143915
public function getErrorMessage($exception)
    {
        $application = $this->application;
        $errorHandler = $this->runner;

        // quit if error occured
        $shouldQuit = $application->isError();

        //
        if($application instanceof Application){
            // if request type ist not strict e.g. xml or json consider error config
            if (!$application->isXmlRequest() && !$application->isJsonRequest()) {
                $shouldQuit = $shouldQuit && $application->getConfig(ApplicationInterface::KEY_ERROR, ApplicationInterface::DEFAULT_ERROR);
            }
        }

        $errorHandler->allowQuit($shouldQuit);

        $method = $errorHandler::EXCEPTION_HANDLER;
        ob_start();
        $errorHandler->$method($exception);
        $message = ob_get_clean();

        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;
    }
1355263
public function renderJson($request, \Exception $exception)
    {
        $this->marshallResponseData($exception);
        
        return $this->prepareJsonResponse($request, $exception);
    }
506578
protected function errorResponse(\Exception $exception)
    {
        $error = $this->config->get('datatables.error');
        $debug = $this->config->get('app.debug');

        if ($error === 'throw' || (! $error && ! $debug)) {
            throw new Exception($exception->getMessage(), $code = 0, $exception);
        }

        $this->getLogger()->error($exception);

        return new JsonResponse([
            'draw'            => (int) $this->request->input('draw'),
            'recordsTotal'    => $this->totalRecords,
            'recordsFiltered' => 0,
            'data'            => [],
            'error'           => $error ? __($error) : "Exception Message:\n\n".$exception->getMessage(),
        ]);
    }
230256
function logError($errorMessage, \Exception $exception)
    {
        if ($this->logger instanceof LoggerInterface) {
            $this->logger->error($errorMessage . "\n" . $exception->getTraceAsString());
        }
    }
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());
    }
274000
public function render($request, Exception $exception)
    {
        if ($exception instanceof TokenExpiredException) {
            return response()->json(['token_expired'], $exception->getCode());
        } else if ($exception instanceof TokenInvalidException) {
            return response()->json(['token_invalid'], $exception->getCode());
        }
        return parent::render($request, $exception);
    }