Skip to content

Commit

Permalink
Merge pull request #488 from nielstron/patch-1
Browse files Browse the repository at this point in the history
Catch GenericFileException in Generate
  • Loading branch information
st3iny authored Jul 29, 2024
2 parents fc79f66 + c08d74a commit ca48f67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/Command/Generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\Encryption\IManager;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\GenericFileException;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\StorageInvalidException;
Expand Down Expand Up @@ -231,9 +232,10 @@ private function parseFile(File $file): void {
$this->previewGenerator->generatePreviews($file, $this->specifications);
} catch (NotFoundException $e) {
// Maybe log that previews could not be generated?
} catch (\InvalidArgumentException $e) {
} catch (\InvalidArgumentException | GenericFileException $e) {
$class = $e::class;
$error = $e->getMessage();
$this->output->writeln("<error>{$error}</error>");
$this->output->writeln("<error>{$class}: {$error}</error>");
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions lib/Command/PreGenerate.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Encryption\IManager;
use OCP\Files\File;
use OCP\Files\GenericFileException;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IConfig;
Expand Down Expand Up @@ -205,9 +206,10 @@ private function processFile(File $file): void {
$this->previewGenerator->generatePreviews($file, $specifications);
} catch (NotFoundException $e) {
// Maybe log that previews could not be generated?
} catch (\InvalidArgumentException $e) {
} catch (\InvalidArgumentException | GenericFileException $e) {
$class = $e::class;
$error = $e->getMessage();
$this->output->writeln("<error>{$error}</error>");
$this->output->writeln("<error>{$class}: {$error}</error>");
}
}
}
Expand Down

0 comments on commit ca48f67

Please sign in to comment.