Skip to content

Commit

Permalink
Catch \Error in transfer:ownership
Browse files Browse the repository at this point in the history
This makes the command more fault tolerant. An \Error can happen when
e.g. the owner of a share is null.

Signed-off-by: Tobia De Koninck <[email protected]>
  • Loading branch information
LEDfan committed Jul 17, 2019
1 parent 32d3c6d commit b72154a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/files/lib/Command/TransferOwnership.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

namespace OCA\Files\Command;

use Error;
use OC\Files\Filesystem;
use OC\Files\View;
use OCP\Files\FileInfo;
Expand Down Expand Up @@ -298,7 +299,9 @@ private function restoreShares(OutputInterface $output) {
} catch (\OCP\Files\NotFoundException $e) {
$output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>');
} catch (\Exception $e) {
$output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>');
$output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getMessage() . '\n' . $e->getTraceAsString() . '</error>');
} catch (\Error $e) {
$output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getMessage() . '\n' . $e->getTraceAsString() . '</error>');
}
$progress->advance();
}
Expand Down

0 comments on commit b72154a

Please sign in to comment.