mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(remote.php): use status code in error handling
Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
parent
d8f465b52d
commit
599ba3d3b9
1 changed files with 9 additions and 5 deletions
14
remote.php
14
remote.php
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue