Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Catch NotFoundExceptions in ShareExtractor #95

Open
micbar opened this issue Aug 5, 2019 · 0 comments
Open

Catch NotFoundExceptions in ShareExtractor #95

micbar opened this issue Aug 5, 2019 · 0 comments
Labels
bug Something isn't working Effort: <0.5md

Comments

@micbar
Copy link
Contributor

micbar commented Aug 5, 2019

Problem

NotFoundExceptions in the ShareExtractor are not visible in the CLI because the the exception has NULL as a message.

It only shows up in the CLI as an empty line.

Solution

Catch the NotFoundExceptions and provide a meaningful message which enables the admin to find the cause of the problem.

+                               try {
+                                       $shareModel->setPath($userFolder->getRelativePath($share->getNode()->getPath()))
+                                               ->setShareType(Share::SHARETYPE_USER)
+                                               ->setOwner($share->getShareOwner())
+                                               ->setSharedBy($share->getSharedBy())
+                                               ->setSharedWith($share->getSharedWith())
+                                               ->setPermissions($share->getPermissions());
+                                       // the rest of the model attributes doesn't make sense with local shares
+                                       $this->streamHelper->writelnToStream(
+                                               $this->streamFile,
+                                               $shareModel
+                                       );
+                               } catch (NotFoundException $exception) {
+                                       $shareId = $share->getId();
+                                       throw new ImportException("Could not find Node for shareId $shareId");
+                               }
@micbar micbar added the bug Something isn't working label Aug 5, 2019
@micbar micbar added this to the Data Exporter Instance Feature milestone Aug 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Effort: <0.5md
Projects
None yet
Development

No branches or pull requests

2 participants