Fix Storage Exceptions

This commit is contained in:
Philipp 2021-08-01 14:31:57 +02:00
parent 29c7552df5
commit 90c99520bb
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
6 changed files with 46 additions and 35 deletions

View file

@ -57,7 +57,11 @@ class Database implements ISelectableStorage
return $result['data'];
} catch (Exception $exception) {
throw new StorageException(sprintf('Database storage failed to get %s', $reference), $exception->getCode(), $exception);
if ($exception instanceof ReferenceStorageException) {
throw $exception;
} else {
throw new StorageException(sprintf('Database storage failed to get %s', $reference), $exception->getCode(), $exception);
}
}
}
@ -101,7 +105,11 @@ class Database implements ISelectableStorage
throw new ReferenceStorageException(sprintf('Database storage failed to delete %s', $reference));
}
} catch (Exception $exception) {
throw new StorageException(sprintf('Database storage failed to delete %s', $reference), $exception->getCode(), $exception);
if ($exception instanceof ReferenceStorageException) {
throw $exception;
} else {
throw new StorageException(sprintf('Database storage failed to delete %s', $reference), $exception->getCode(), $exception);
}
}
}