libutil: wrap async kj exceptions as errors
this is important for rpc error reporting: if the peer disconnects we want to throw a useful error that can e.g. let pending builds finish, not kill the entire process because kj errors are non-lix exceptions. Change-Id: I41ebe10ad7fd65d886238ce52eeca1fa243b1bb2
This commit is contained in:
@@ -121,6 +121,11 @@ T runAsyncUnwrap(Result<T> t)
|
||||
} catch (::nix::BaseException & e) { \
|
||||
e.addAsyncTrace(::std::source_location::current(), _l_ctx()); \
|
||||
throw; \
|
||||
/* NOLINTNEXTLINE(lix-foreign-exceptions) */ \
|
||||
} catch (::kj::Exception & e) { \
|
||||
::nix::Error fe{e.getDescription().cStr()}; \
|
||||
fe.addAsyncTrace(::std::source_location::current(), _l_ctx()); \
|
||||
throw fe; \
|
||||
} catch (...) { \
|
||||
auto fe = ::nix::ForeignException::wrapCurrent(); \
|
||||
fe.addAsyncTrace(::std::source_location::current(), _l_ctx()); \
|
||||
|
||||
Reference in New Issue
Block a user