diff options
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 8e029fb4874a..1750e03737b7 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -1215,4 +1215,15 @@ string base64Decode(const string & s) } +void callFailure(const std::function<void(std::exception_ptr exc)> & failure) +{ + try { + failure(std::current_exception()); + } catch (std::exception & e) { + printMsg(lvlError, format("uncaught exception: %s") % e.what()); + abort(); + } +} + + } |