Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add catch for RuntimeException
getDirectoryListing can throw a NotFoundException or a RuntimeException.
The repair step should be skipped if the cache directory is missing so
a catch for both exceptions is required.

Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
kesselb committed May 17, 2019
commit b693487d64f088969e94ade99cfab8bd3dd7d6b0
3 changes: 2 additions & 1 deletion lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCP\ILogger;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
use RuntimeException;

/**
* Class CleanupCardDAVPhotoCache
Expand Down Expand Up @@ -63,7 +64,7 @@ public function getName(): string {
private function repair(IOutput $output): void {
try {
$folders = $this->appData->getDirectoryListing();
} catch (NotFoundException $e) {
} catch (NotFoundException|RuntimeException $e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem with this is that this is now not logged anymore 🙈

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Please catch is separataly and log it for easier debugging

Copy link
Contributor Author

@kesselb kesselb May 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against it but that looks like the wrong place. If the permissions for appdata are broken we should prevent the upgrade and show a warning. Doing this inside a repair job sounds wrong to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still it should be logged. Let me add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok 🤷‍♂️

return;
}

Expand Down