Skip to content

Commit

Permalink
CollectiveService: Catch exception when deleting a collective
Browse files Browse the repository at this point in the history
  • Loading branch information
mejo- committed Aug 22, 2020
1 parent bf84053 commit fb8fbdc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Service/CollectiveService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
use OCA\Collectives\Fs\NodeHelper;
use OCA\Collectives\Mount\CollectiveRootPathHelper;
use OCP\AppFramework\QueryException;
use OCP\Files\InvalidPathException;
use OCP\Files\IRootFolder;
use OCP\Files\NotPermittedException;

class CollectiveService {
/** @var CollectiveMapper */
Expand Down Expand Up @@ -107,8 +109,8 @@ public function deleteCollective(string $userId, int $id): Collective {
throw new NotFoundException('Circle not found: ' . $collective->getCircleUniqueId());
}

$collectiveFolder = $this->rootFolder->get($this->collectiveRootPathHelper->get() . '/' . $collective->getId());
try {
$collectiveFolder = $this->rootFolder->get($this->collectiveRootPathHelper->get() . '/' . $collective->getId());
$collectiveFolder->delete();
} catch (InvalidPathException | \OCP\Files\NotFoundException | NotPermittedException $e) {
throw new NotFoundException('Failed to delete collective folder');
Expand Down

0 comments on commit fb8fbdc

Please sign in to comment.