]> source.dussan.org Git - nextcloud-server.git/commitdiff
Log exceptions when creating share 26130/head
authorVincent Petry <vincent@nextcloud.com>
Mon, 15 Mar 2021 11:00:41 +0000 (12:00 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 15 Mar 2021 15:06:43 +0000 (15:06 +0000)
Because the exceptions don't always contain a useful message for the UI,
but also because in some cases we need to find out what went wrong.

In some setups, a ShareNotFoundException might happen during creation
when we try to re-read the just written share. Usually related to Galera
Cluster where node syncing wait is not enabled.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
apps/files_sharing/lib/Controller/ShareAPIController.php

index 2a2e2614811a5cbb5f0f0c6eb9fb68a95cfc9723..f3b107c6de5b117c5673dd1869b3e68368a37c9d 100644 (file)
@@ -616,9 +616,11 @@ class ShareAPIController extends OCSController {
                try {
                        $share = $this->shareManager->createShare($share);
                } catch (GenericShareException $e) {
+                       \OC::$server->getLogger()->logException($e);
                        $code = $e->getCode() === 0 ? 403 : $e->getCode();
                        throw new OCSException($e->getHint(), $code);
                } catch (\Exception $e) {
+                       \OC::$server->getLogger()->logException($e);
                        throw new OCSForbiddenException($e->getMessage(), $e);
                }