From: Christoph Wurst Date: Tue, 16 Jun 2020 13:37:20 +0000 (+0200) Subject: Fix invalid usage of \Exception::getResult X-Git-Tag: v20.0.0beta1~413^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=94a95ffceb0ec16b333d13a0742a5e0c2c1ed93e;p=nextcloud-server.git Fix invalid usage of \Exception::getResult Only OCS exceptions have a getResult method. Any other exception will cause another error due to this invalid method call. This splits the catch into a specific one for OCS and then a generic one for anything else that can't be handled. Signed-off-by: Christoph Wurst --- diff --git a/ocs/v1.php b/ocs/v1.php index 983bfd5f77d..0c24aa814eb 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -67,9 +67,15 @@ try { OC_API::setContentType(); http_response_code(405); exit(); -} catch (Exception $ex) { +} catch (\OC\OCS\Exception $ex) { OC_API::respond($ex->getResult(), OC_API::requestedFormat()); exit(); +} catch (Throwable $ex) { + OC::$server->getLogger()->logException($ex); + + OC_API::setContentType(); + http_response_code(500); + exit(); } /*