fix(remote.php): use status code in error handling

Signed-off-by: Josh <josh.t.richards@gmail.com>
pull/56170/head
Josh 2025-11-03 12:54:05 +07:00 committed by GitHub
parent da1083b5c5
commit a757513280
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 5 deletions

@ -54,16 +54,20 @@ 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 ($ex instanceof ServiceUnavailableException && $e->getCode === 0) {
$status = 503;
}
if ($e->getCode() > 0) {
$status = $e->getCode();
} else {
$status = 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) {