Skip to content

Commit 97f3e9d

Browse files
ChristophWurstbackportbot[bot]
authored andcommitted
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>
1 parent c9f0f5a commit 97f3e9d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ocs/v1.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@
6767
OC_API::setContentType();
6868
http_response_code(405);
6969
exit();
70-
} catch (Exception $ex) {
70+
} catch (\OC\OCS\Exception $ex) {
7171
OC_API::respond($ex->getResult(), OC_API::requestedFormat());
7272
exit();
73+
} catch (Throwable $ex) {
74+
OC::$server->getLogger()->logException($ex);
75+
76+
OC_API::setContentType();
77+
http_response_code(500);
78+
exit();
7379
}
7480

7581
/*

0 commit comments

Comments
 (0)