From e43c93881ed319bfbebf10836b1ce50a89b75dd0 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 15 Mar 2021 12:00:41 +0100 Subject: [PATCH] Log exceptions when creating share 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 --- apps/files_sharing/lib/Controller/ShareAPIController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 3ae9d4bd49..8388c8efe7 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -593,9 +593,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); }