File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,9 +89,10 @@ function resolveService(string $service): string {
8989 $ baseuri = OC ::$ WEBROOT . '/public.php/ ' . $ service . '/ ' ;
9090 require_once $ file ;
9191} catch (Exception $ ex ) {
92- $ status = 500 ;
93- if ($ ex instanceof ServiceUnavailableException) {
94- $ status = 503 ;
92+ if ($ ex ->getCode () > 0 ) {
93+ $ status = $ ex ->getCode ();
94+ } else {
95+ $ status = $ ex instanceof ServiceUnavailableException ? 503 : 500 ;
9596 }
9697 //show the user a detailed error page
9798 Server::get (LoggerInterface::class)->error ($ ex ->getMessage (), ['app ' => 'public ' , 'exception ' => $ ex ]);
Original file line number Diff line number Diff line change @@ -54,16 +54,17 @@ function handleException(Exception|Error $e): void {
5454 });
5555 $ server ->exec ();
5656 } else {
57- $ statusCode = 500 ;
58- if ($ e instanceof ServiceUnavailableException) {
59- $ statusCode = 503 ;
60- }
6157 if ($ e instanceof RemoteException) {
6258 // we shall not log on RemoteException
6359 \OCP \Server::get (ITemplateManager::class)->printErrorPage ($ e ->getMessage (), '' , $ e ->getCode ());
6460 } else {
61+ if ($ e ->getCode () > 0 ) {
62+ $ status = $ e ->getCode ();
63+ } else {
64+ $ status = $ e instanceof ServiceUnavailableException ? 503 : 500 ;
65+ }
6566 \OCP \Server::get (LoggerInterface::class)->error ($ e ->getMessage (), ['app ' => 'remote ' ,'exception ' => $ e ]);
66- \OCP \Server::get (ITemplateManager::class)->printExceptionErrorPage ($ e , $ statusCode );
67+ \OCP \Server::get (ITemplateManager::class)->printExceptionErrorPage ($ e , $ status );
6768 }
6869 }
6970 } catch (\Exception $ e ) {
You can’t perform that action at this time.
0 commit comments