Fix Storage Exceptions

This commit is contained in:
Philipp
2021-08-01 14:31:57 +02:00
parent 29c7552df5
commit 90c99520bb
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);
}
}
}