Skip to content

Commit b69b84e

Browse files
committed
fixup: catch BaseError instead of Error
That way it catches both nix::Error as well as nix::Interrupted.
1 parent 44e2e32 commit b69b84e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/libstore/filetransfer.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,10 @@ struct curlFileTransfer : public FileTransfer
982982
auto item = make_ref<TransferItem>(*this, std::move(modifiedRequest), std::move(callback));
983983
try {
984984
return enqueueItem(item);
985-
} catch (const nix::Error & e) {
985+
} catch (const nix::BaseError & e) {
986+
// NOTE(cole-h): catches both nix::Error and nix::Interrupted -- enqueueItem calls
987+
// writeFull which may throw nix::Interrupted, and the rest of enqueueItem may throw
988+
// nix::Error
986989
item->fail(e);
987990
return ItemHandle(item.get_ptr());
988991
}
@@ -991,7 +994,10 @@ struct curlFileTransfer : public FileTransfer
991994
auto item = make_ref<TransferItem>(*this, request, std::move(callback));
992995
try {
993996
return enqueueItem(item);
994-
} catch (const nix::Error & e) {
997+
} catch (const nix::BaseError & e) {
998+
// NOTE(cole-h): catches both nix::Error and nix::Interrupted -- enqueueItem calls
999+
// writeFull which may throw nix::Interrupted, and the rest of enqueueItem may throw
1000+
// nix::Error
9951001
item->fail(e);
9961002
return ItemHandle(item.get_ptr());
9971003
}

0 commit comments

Comments
 (0)