diff --git a/public.php b/public.php index 8ae6deff203..d8cdd347170 100644 --- a/public.php +++ b/public.php @@ -89,10 +89,14 @@ try { $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; require_once $file; } catch (Exception $ex) { - $status = 500; - if ($ex instanceof ServiceUnavailableException) { + if ($ex instanceof ServiceUnavailableException && $ex->getCode === 0) { $status = 503; } + if ($ex->getCode() > 0) { + $status = $ex->getCode(); + } else { + $status = 500; + } //show the user a detailed error page Server::get(LoggerInterface::class)->error($ex->getMessage(), ['app' => 'public', 'exception' => $ex]); Server::get(ITemplateManager::class)->printExceptionErrorPage($ex, $status);