mirror of
https://github.com/NixOS/nix.git
synced 2025-11-22 10:19: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);
|
||||
}
|
||||
|
||||
int progressCallback(curl_off_t dltotal, curl_off_t dlnow)
|
||||
{
|
||||
try {
|
||||
act.progress(dlnow, dltotal);
|
||||
} catch (nix::Interrupted &) {
|
||||
assert(getInterrupted());
|
||||
}
|
||||
int progressCallback(curl_off_t dltotal, curl_off_t dlnow) noexcept
|
||||
try {
|
||||
act.progress(dlnow, dltotal);
|
||||
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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue