Report or log an exception.

@param  \Exception $e

@return void

@throws \Exception
488304
public function report(Exception $e)
    {
        logger()->error('PHP Error', [
            'file'    => $e->getFile(),
            'line'    => $e->getLine(),
            'message' => $e->getMessage()
        ]);
    }
1063042
protected static function logError(self $e): void
    {
        if (class_exists('\Osf\Log\LogProxy')) {
            $msg = get_class($e) . ' : ' . $e->getMessage();
            try {
                \Osf\Log\LogProxy::log($msg, $e->getLogLevel(), 'PHPERR', $e->getTraceAsString());
            } catch (\Exception $ex) {
                file_put_contents(sys_get_temp_dir() . '/undisplayed-sma-errors.log', date('Ymd-His-') . $ex->getMessage(), FILE_APPEND);
            }
        }
    }
960404
public function logCriticalException(\Exception $e)
    {
        if ($this->getServerContext()->hasLogger(LoggerUtils::SYSTEM)) {
            $this->getServerContext()->getLogger(LoggerUtils::SYSTEM)->critical($e->__toString());
        }
    }
916804
public static function handle(Exception $e)
    {
        if ($e instanceof AtomikHttpException) {
            header('Location: ', false, $e->getCode());
            if ($e->getCode() === 404) {
                header('Content-type: text/html');
                if ($output = Atomik::render(self::$config['404_view'], array('exception' => $e))) {
                    echo $output;
                } else {
                    echo '<h1>Page not found</h1>';
                }
            }
        } else {
            header('Location: ', false, 500);
            if (self::$config['catch_errors']) {
                if ($output = Atomik::render(self::$config['error_view'], array('exception' => $e))) {
                    echo $output;
                } else {
                    echo self::render($e);
                }
            } else if (self::$config['throw_errors']) {
                throw $e;
            }
        }
    }
429358
public function logException(\Exception $e)
    {
        $error = $e->getMessage() . $e->getTraceAsString();
        return $this->logEmergency($error);
    }
334636
protected function logException(\Exception $exception): void
    {
        if (!$this->logger) {
            return;
        }

        $message = sprintf(
            'Exception thrown when handling an exception (%s: %s at %s line %s)',
            get_class($exception),
            $exception->getMessage(),
            $exception->getFile(),
            $exception->getLine()
        );

        $this->logger->log($this->level, $message, [
            'exception' => $exception,
        ]);
    }
1300992
public function logDebugException(\Exception $e)
    {
        if ($this->getServerContext()->hasLogger(LoggerUtils::SYSTEM)) {
            $this->getServerContext()->getLogger(LoggerUtils::SYSTEM)->debug($e->__toString());
        }
    }
1191509
public function report(Exception $e)
    {
        if (app()->bound('sentry') && $this->shouldReport($e)) {
            app('sentry')->captureException($e);
        }

        return parent::report($e);
    }
815951
public function report(Exception $e)
    {
        if ($this->shouldReport($e)) {
            $class = addslashes(get_class($e));
            $message = addslashes($e->getMessage());
            $file = addslashes($e->getFile());
            $line = addslashes($e->getLine());
            $time = date('c');
            // log locally
            $log = sprintf("[%s] [%s] %s thrown in %s on line %d\n", $time, $class, $message, $file, $line);
            error_log($log, 3, $this->di->logPath() . DIRECTORY_SEPARATOR . '/pails.error.log');
            // log to system
            $syslog = sprintf('[%s] %s thrown in %s on line %d', $class, $message, $file, $line);
            error_log($syslog);
        }
    }
628796
protected function logException( \Exception $e )
	{
		$logger = $this->context->getLogger();

		$logger->log( $e->getMessage(), \Aimeos\MW\Logger\Base::WARN, 'client/html' );
		$logger->log( $e->getTraceAsString(), \Aimeos\MW\Logger\Base::WARN, 'client/html' );
	}
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());
		}
	}
1056920
private function handleForConsole(Exception $e)
    {
        if ($e instanceof StopException) {
            $output = $e->getMessage();
        }
        else {
            $data = $this->convertException($e);
            $class = get_class($e);
            $file  = $this->stripFile($data['file']);
            $line  = $data['line'];
            $code  = $data['code'];

            // set the error message
            if ($e instanceof HttpException) {
                $message = http_status_text($data['status']) . ' (' . $data['status'] . ')';
                if (!empty($data['message'])) {
                    $message .=  '. ' . $data['message'];
                }
            }
            else if ($e instanceof QueryException) {
                $message = $data['message'] . '; sql: ' . $data['sql'];
            }
            else {
                $message = $data['message'];
            }

            $output = $class . ' in "' . $file . '", line ' . $line . ':' . PHP_EOL . $message . ' (code ' . $code . ')';
        }

        stdio()->error($output);

        $exitCode = $e->getCode();
        if ($exitCode === null) {
            $exitCode = Command::EXIT_FAILURE;
        }

        exit ($exitCode);
    }
335505
protected function renderException($output, \Exception $e)
    {
        $this->app[ExceptionHandler::class]->renderForConsole($output, $e);
    }
340649
public function handleException($e)
    {
        if (!$e instanceof Exception) { // Since PHP 7, in addition to an Exception, an internal Error may occur.
            // Convert the Error to ErrorException
            $e = new ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); // @codeCoverageIgnore
        } // @codeCoverageIgnore

        $this->getExceptionHandler()->handle($e);
    }
379732
public function caughtException($e)
    {
        $this->hook('caught-exception', array($e));
        echo get_class($e), ': '.$e->getMessage();
        exit;
    }
98751
public function exception($e) {
        $type = "system";
        if (isset($_GET['type'])) {
            $type = $_GET['type'];
        }
        switch ($type) {
        case 'dapi':
        case 'api':
            $this->exception[] = $e;
            break;
        case 'page':
        default:
            require __DIR__ . '/exception.php';
            break;
        }
    }
1047008
protected function error(\Exception $e)
    {
        $str  = sprintf("Message: %s\r\n", $e->getMessage());
        $str .= sprintf("Code: %s\r\n", $e->getCode());
        $str .= sprintf("File: %s (line: %s)\r\n", $e->getFile(), $e->getLine());
        $str .= sprintf("Trade: %s\r\n", $e->getTraceAsString());

        if ($this->log instanceof \Closure)
        {
            $log = $this->log;
            $log($str);
        }
    }