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>
pull/21432/head
Christoph Wurst 4 years ago
parent 5e52c110bb
commit 94a95ffceb
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8

@ -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();
}
/*

Loading…
Cancel
Save