Skip to content

Commit

Permalink
fix: Avoid throwing erased status-codes
Browse files Browse the repository at this point in the history
  • Loading branch information
BurningEnlightenment committed Feb 17, 2024
1 parent daa88c4 commit 8cb3453
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/vefs/vfilesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ auto vfilesystem::commit() -> result<void>
detail::lut::sector_position_of(mCommittedRoot.maximum_extent - 1)};
index_tree_layout layout(*mIndexTree, mIndexBlocks, lastAllocated);

system_error::error syncError{};
for (auto const &[path, fid] : lockedIndex)
{
try
Expand All @@ -989,19 +990,18 @@ auto vfilesystem::commit() -> result<void>
vefs::copy(pathBytes,
as_writable_bytes(std::span(descriptor.filePath)));

if (auto syncrx = layout.sync_to_tree(e, descriptor); !syncrx)
if (auto syncrx = layout.sync_to_tree(e, descriptor);
syncrx.has_failure())
{
syncrx.assume_error()
<< ed::archive_file{"[archive-index]"};
syncrx.error() << ed::archive_file{"[archive-index]"};

// note that this isn't a child of std::exception
throw std::move(syncrx).assume_error();
syncError = std::move(syncrx).assume_error();
}
});
if (!syncError.empty())
{
return syncError;
}
catch (system_error::error const &error)
{
return error.clone();
}
catch (std::bad_alloc const &)
{
Expand Down

0 comments on commit 8cb3453

Please sign in to comment.