This commit is contained in:
Josh 2026-02-03 19:58:05 -01:00 committed by GitHub
commit 298d0f948f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View file

@ -89,9 +89,10 @@ try {
$baseuri = OC::$WEBROOT . '/public.php/' . $service . '/';
require_once $file;
} catch (Exception $ex) {
$status = 500;
if ($ex instanceof ServiceUnavailableException) {
$status = 503;
if ($ex->getCode() > 0) {
$status = $ex->getCode();
} else {
$status = $ex instanceof ServiceUnavailableException ? 503 : 500;
}
//show the user a detailed error page
Server::get(LoggerInterface::class)->error($ex->getMessage(), ['app' => 'public', 'exception' => $ex]);

View file

@ -54,16 +54,17 @@ function handleException(Exception|Error $e): void {
});
$server->exec();
} else {
$statusCode = 500;
if ($e instanceof ServiceUnavailableException) {
$statusCode = 503;
}
if ($e instanceof RemoteException) {
// we shall not log on RemoteException
\OCP\Server::get(ITemplateManager::class)->printErrorPage($e->getMessage(), '', $e->getCode());
} else {
if ($e->getCode() > 0) {
$status = $e->getCode();
} else {
$status = $e instanceof ServiceUnavailableException ? 503 : 500;
}
\OCP\Server::get(LoggerInterface::class)->error($e->getMessage(), ['app' => 'remote','exception' => $e]);
\OCP\Server::get(ITemplateManager::class)->printExceptionErrorPage($e, $statusCode);
\OCP\Server::get(ITemplateManager::class)->printExceptionErrorPage($e, $status);
}
}
} catch (\Exception $e) {