When removing a block, check whether it was successful
This commit is contained in:
parent
4b33d88253
commit
bb54c2f879
@ -81,7 +81,10 @@ optional<unique_ref<OnDiskBlock>> OnDiskBlock::CreateOnDisk(const bf::path &root
|
|||||||
void OnDiskBlock::RemoveFromDisk(const bf::path &rootdir, const Key &key) {
|
void OnDiskBlock::RemoveFromDisk(const bf::path &rootdir, const Key &key) {
|
||||||
auto filepath = rootdir / key.ToString();
|
auto filepath = rootdir / key.ToString();
|
||||||
ASSERT(bf::is_regular_file(filepath), "Block not found on disk");
|
ASSERT(bf::is_regular_file(filepath), "Block not found on disk");
|
||||||
bf::remove(filepath);
|
bool retval = bf::remove(filepath);
|
||||||
|
if (!retval) {
|
||||||
|
throw std::runtime_error("Couldn't find block to remove");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDiskBlock::_storeToDisk() const {
|
void OnDiskBlock::_storeToDisk() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user