mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 01:26:15 +02:00
Tweak
This commit is contained in:
parent
f12d56b27b
commit
beaefdf706
3 changed files with 5 additions and 8 deletions
|
@ -98,11 +98,7 @@ struct CurlDownloader : public Downloader
|
||||||
{
|
{
|
||||||
assert(!done);
|
assert(!done);
|
||||||
done = true;
|
done = true;
|
||||||
try {
|
callFailure(failure, std::make_exception_ptr(e));
|
||||||
throw e;
|
|
||||||
} catch (...) {
|
|
||||||
callFailure(failure);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t writeCallback(void * contents, size_t size, size_t nmemb)
|
size_t writeCallback(void * contents, size_t size, size_t nmemb)
|
||||||
|
|
|
@ -1230,10 +1230,10 @@ string base64Decode(const string & s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void callFailure(const std::function<void(std::exception_ptr exc)> & failure)
|
void callFailure(const std::function<void(std::exception_ptr exc)> & failure, std::exception_ptr exc)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
failure(std::current_exception());
|
failure(exc);
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
printMsg(lvlError, format("uncaught exception: %s") % e.what());
|
printMsg(lvlError, format("uncaught exception: %s") % e.what());
|
||||||
abort();
|
abort();
|
||||||
|
|
|
@ -383,7 +383,8 @@ string get(const T & map, const string & key, const string & def = "")
|
||||||
|
|
||||||
/* Call ‘failure’ with the current exception as argument. If ‘failure’
|
/* Call ‘failure’ with the current exception as argument. If ‘failure’
|
||||||
throws an exception, abort the program. */
|
throws an exception, abort the program. */
|
||||||
void callFailure(const std::function<void(std::exception_ptr exc)> & failure);
|
void callFailure(const std::function<void(std::exception_ptr exc)> & failure,
|
||||||
|
std::exception_ptr exc = std::current_exception());
|
||||||
|
|
||||||
|
|
||||||
/* Evaluate the function ‘f’. If it returns a value, call ‘success’
|
/* Evaluate the function ‘f’. If it returns a value, call ‘success’
|
||||||
|
|
Loading…
Reference in a new issue