diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/util.cc | 4 | ||||
-rw-r--r-- | src/libutil/util.hh | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index c95a713fa112..68311a3df8ef 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -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 { - failure(std::current_exception()); + failure(exc); } catch (std::exception & e) { printMsg(lvlError, format("uncaught exception: %s") % e.what()); abort(); diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 221165780a37..1a43bf400a03 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -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’ 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’ |