Skip to content

Commit 1ba1c51

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

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
@@ -975,7 +975,10 @@ struct curlFileTransfer : public FileTransfer
975975
auto item = make_ref<TransferItem>(*this, std::move(modifiedRequest), std::move(callback));
976976
try {
977977
return enqueueItem(item);
978-
} catch (const nix::Error & e) {
978+
} catch (const nix::BaseError & e) {
979+
// NOTE(cole-h): catches both nix::Error and nix::Interrupted -- enqueueItem calls
980+
// writeFull which may throw nix::Interrupted, and the rest of enqueueItem may throw
981+
// nix::Error
979982
item->fail(e);
980983
return ItemHandle(ref<Item>(std::move(item)));
981984
}
@@ -984,7 +987,10 @@ struct curlFileTransfer : public FileTransfer
984987
auto item = make_ref<TransferItem>(*this, request, std::move(callback));
985988
try {
986989
return enqueueItem(item);
987-
} catch (const nix::Error & e) {
990+
} catch (const nix::BaseError & e) {
991+
// NOTE(cole-h): catches both nix::Error and nix::Interrupted -- enqueueItem calls
992+
// writeFull which may throw nix::Interrupted, and the rest of enqueueItem may throw
993+
// nix::Error
988994
item->fail(e);
989995
return ItemHandle(ref<Item>(std::move(item)));
990996
}

0 commit comments

Comments
 (0)