Skip to content

Commit

Permalink
Catch FileNotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
Michiel-s committed Apr 26, 2024
1 parent 7d2d4d5 commit fc39577
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Additional labels for pre-release and build metadata are available as extensions

## Unreleased changes
* [Issue 79](https://github.com/AmpersandTarski/prototype/issues/79) Add support for delimited multi value columns in excel importer
* Catch FileNotFoundException and log warning when corresponding file of deleted FileObject is not found on filesystem
* Skip tracking affected relations and concepts for RELATION lastAccess[SESSION*DateTime]
* Add codebase of new developed frontend. Not integrated in building image yet.

Expand Down
7 changes: 6 additions & 1 deletion src/Ampersand/Interfacing/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Ampersand\Interfacing\ResourceList;
use Ampersand\Exception\AtomNotFoundException;
use Ampersand\Exception\BadRequestException;
use League\Flysystem\FileNotFoundException;

/**
*
Expand Down Expand Up @@ -349,7 +350,11 @@ public function delete(): self

// Special case for FileObject: delete files from file system
foreach ($filePaths as $path) {
$this->concept->getApp()->fileSystem()->delete($path);
try {
$this->concept->getApp()->fileSystem()->delete($path);
} catch (FileNotFoundException $e) {
Logger::getLogger('INTERFACING')->warning("Corresponding file for deleted FileObject '{$this->id}' was not found at path '{$path}'. The filesystem and database might be out of sync if this occurs more often");
}
}
} else {
// Perform DELETE using the interface definition
Expand Down

0 comments on commit fc39577

Please sign in to comment.