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 <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2020-06-16 15:37:20 +02:00 committed by backportbot[bot]
parent c9f0f5a0d9
commit 97f3e9d391
1 changed files with 7 additions and 1 deletions

View File

@ -67,9 +67,15 @@ try {
OC_API::setContentType(); OC_API::setContentType();
http_response_code(405); http_response_code(405);
exit(); exit();
} catch (Exception $ex) { } catch (\OC\OCS\Exception $ex) {
OC_API::respond($ex->getResult(), OC_API::requestedFormat()); OC_API::respond($ex->getResult(), OC_API::requestedFormat());
exit(); exit();
} catch (Throwable $ex) {
OC::$server->getLogger()->logException($ex);
OC_API::setContentType();
http_response_code(500);
exit();
} }
/* /*