mirror of
https://github.com/NixOS/nix.git
synced 2025-11-22 02:09:36 +01:00
libstore/filetransfer: Handle exceptions in progressCallback
This commit is contained in:
parent
87d3c3ba1a
commit
b3dfe37aea
1 changed files with 10 additions and 7 deletions
|
|
@ -277,14 +277,17 @@ struct curlFileTransfer : public FileTransfer
|
||||||
return ((TransferItem *) userp)->headerCallback(contents, size, nmemb);
|
return ((TransferItem *) userp)->headerCallback(contents, size, nmemb);
|
||||||
}
|
}
|
||||||
|
|
||||||
int progressCallback(curl_off_t dltotal, curl_off_t dlnow)
|
int progressCallback(curl_off_t dltotal, curl_off_t dlnow) noexcept
|
||||||
{
|
try {
|
||||||
try {
|
act.progress(dlnow, dltotal);
|
||||||
act.progress(dlnow, dltotal);
|
|
||||||
} catch (nix::Interrupted &) {
|
|
||||||
assert(getInterrupted());
|
|
||||||
}
|
|
||||||
return getInterrupted();
|
return getInterrupted();
|
||||||
|
} catch (nix::Interrupted &) {
|
||||||
|
assert(getInterrupted());
|
||||||
|
return 1;
|
||||||
|
} catch (...) {
|
||||||
|
/* Something unexpected has happened like logger throwing an exception. */
|
||||||
|
callbackException = std::current_exception();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int progressCallbackWrapper(
|
static int progressCallbackWrapper(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue