Skip to content

Commit

Permalink
Log exceptions when creating share
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
PVince81 authored and backportbot[bot] committed Mar 15, 2021
1 parent 3ac0601 commit e43c938
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,11 @@ public function createShare(
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);
}

Expand Down

0 comments on commit e43c938

Please sign in to comment.