@@ -32,59 +32,59 @@ |
||
| 32 | 32 | require_once __DIR__ . '/lib/versioncheck.php'; |
| 33 | 33 | |
| 34 | 34 | try { |
| 35 | - require_once __DIR__ . '/lib/base.php'; |
|
| 35 | + require_once __DIR__ . '/lib/base.php'; |
|
| 36 | 36 | |
| 37 | - OC::handleRequest(); |
|
| 37 | + OC::handleRequest(); |
|
| 38 | 38 | } catch (\OC\ServiceUnavailableException $ex) { |
| 39 | - \OC::$server->getLogger()->logException($ex, ['app' => 'index']); |
|
| 39 | + \OC::$server->getLogger()->logException($ex, ['app' => 'index']); |
|
| 40 | 40 | |
| 41 | - //show the user a detailed error page |
|
| 42 | - OC_Template::printExceptionErrorPage($ex, 503); |
|
| 41 | + //show the user a detailed error page |
|
| 42 | + OC_Template::printExceptionErrorPage($ex, 503); |
|
| 43 | 43 | } catch (\OC\HintException $ex) { |
| 44 | - try { |
|
| 45 | - OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503); |
|
| 46 | - } catch (Exception $ex2) { |
|
| 47 | - try { |
|
| 48 | - \OC::$server->getLogger()->logException($ex, ['app' => 'index']); |
|
| 49 | - \OC::$server->getLogger()->logException($ex2, ['app' => 'index']); |
|
| 50 | - } catch (Throwable $e) { |
|
| 51 | - // no way to log it properly - but to avoid a white page of death we try harder and ignore this one here |
|
| 52 | - } |
|
| 44 | + try { |
|
| 45 | + OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503); |
|
| 46 | + } catch (Exception $ex2) { |
|
| 47 | + try { |
|
| 48 | + \OC::$server->getLogger()->logException($ex, ['app' => 'index']); |
|
| 49 | + \OC::$server->getLogger()->logException($ex2, ['app' => 'index']); |
|
| 50 | + } catch (Throwable $e) { |
|
| 51 | + // no way to log it properly - but to avoid a white page of death we try harder and ignore this one here |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - //show the user a detailed error page |
|
| 55 | - OC_Template::printExceptionErrorPage($ex, 500); |
|
| 56 | - } |
|
| 54 | + //show the user a detailed error page |
|
| 55 | + OC_Template::printExceptionErrorPage($ex, 500); |
|
| 56 | + } |
|
| 57 | 57 | } catch (\OC\User\LoginException $ex) { |
| 58 | - $request = \OC::$server->getRequest(); |
|
| 59 | - /** |
|
| 60 | - * Routes with the @CORS annotation and other API endpoints should |
|
| 61 | - * not return a webpage, so we only print the error page when html is accepted, |
|
| 62 | - * otherwise we reply with a JSON array like the SecurityMiddleware would do. |
|
| 63 | - */ |
|
| 64 | - if (stripos($request->getHeader('Accept'),'html') === false) { |
|
| 65 | - http_response_code(401); |
|
| 66 | - header('Content-Type: application/json; charset=utf-8'); |
|
| 67 | - echo json_encode(['message' => $ex->getMessage()]); |
|
| 68 | - exit(); |
|
| 69 | - } |
|
| 70 | - OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 401); |
|
| 58 | + $request = \OC::$server->getRequest(); |
|
| 59 | + /** |
|
| 60 | + * Routes with the @CORS annotation and other API endpoints should |
|
| 61 | + * not return a webpage, so we only print the error page when html is accepted, |
|
| 62 | + * otherwise we reply with a JSON array like the SecurityMiddleware would do. |
|
| 63 | + */ |
|
| 64 | + if (stripos($request->getHeader('Accept'),'html') === false) { |
|
| 65 | + http_response_code(401); |
|
| 66 | + header('Content-Type: application/json; charset=utf-8'); |
|
| 67 | + echo json_encode(['message' => $ex->getMessage()]); |
|
| 68 | + exit(); |
|
| 69 | + } |
|
| 70 | + OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 401); |
|
| 71 | 71 | } catch (Exception $ex) { |
| 72 | - \OC::$server->getLogger()->logException($ex, ['app' => 'index']); |
|
| 72 | + \OC::$server->getLogger()->logException($ex, ['app' => 'index']); |
|
| 73 | 73 | |
| 74 | - //show the user a detailed error page |
|
| 75 | - OC_Template::printExceptionErrorPage($ex, 500); |
|
| 74 | + //show the user a detailed error page |
|
| 75 | + OC_Template::printExceptionErrorPage($ex, 500); |
|
| 76 | 76 | } catch (Error $ex) { |
| 77 | - try { |
|
| 78 | - \OC::$server->getLogger()->logException($ex, ['app' => 'index']); |
|
| 79 | - } catch (Error $e) { |
|
| 80 | - http_response_code(500); |
|
| 81 | - header('Content-Type: text/plain; charset=utf-8'); |
|
| 82 | - print("Internal Server Error\n\n"); |
|
| 83 | - print("The server encountered an internal error and was unable to complete your request.\n"); |
|
| 84 | - print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); |
|
| 85 | - print("More details can be found in the webserver log.\n"); |
|
| 77 | + try { |
|
| 78 | + \OC::$server->getLogger()->logException($ex, ['app' => 'index']); |
|
| 79 | + } catch (Error $e) { |
|
| 80 | + http_response_code(500); |
|
| 81 | + header('Content-Type: text/plain; charset=utf-8'); |
|
| 82 | + print("Internal Server Error\n\n"); |
|
| 83 | + print("The server encountered an internal error and was unable to complete your request.\n"); |
|
| 84 | + print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); |
|
| 85 | + print("More details can be found in the webserver log.\n"); |
|
| 86 | 86 | |
| 87 | - throw $ex; |
|
| 88 | - } |
|
| 89 | - OC_Template::printExceptionErrorPage($ex, 500); |
|
| 87 | + throw $ex; |
|
| 88 | + } |
|
| 89 | + OC_Template::printExceptionErrorPage($ex, 500); |
|
| 90 | 90 | } |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
| 32 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
| 33 | 33 | |
| 34 | 34 | try { |
| 35 | - require_once __DIR__ . '/lib/base.php'; |
|
| 35 | + require_once __DIR__.'/lib/base.php'; |
|
| 36 | 36 | |
| 37 | 37 | OC::handleRequest(); |
| 38 | 38 | } catch (\OC\ServiceUnavailableException $ex) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * not return a webpage, so we only print the error page when html is accepted, |
| 62 | 62 | * otherwise we reply with a JSON array like the SecurityMiddleware would do. |
| 63 | 63 | */ |
| 64 | - if (stripos($request->getHeader('Accept'),'html') === false) { |
|
| 64 | + if (stripos($request->getHeader('Accept'), 'html') === false) { |
|
| 65 | 65 | http_response_code(401); |
| 66 | 66 | header('Content-Type: application/json; charset=utf-8'); |
| 67 | 67 | echo json_encode(['message' => $ex->getMessage()]); |