Catch sdbus-c++ exceptions flying from Proxy callbacks to libsystemd

This commit is contained in:
Stanislav Angelovic
2021-07-22 14:33:38 +02:00
committed by Urs Ritzmann
parent 6433b38ed1
commit b4f5c0f46c
3 changed files with 27 additions and 22 deletions

View File

@ -593,7 +593,7 @@ namespace sdbus {
{
reply >> args;
}
catch (const sdbus::Error& e)
catch (const Error& e)
{
// Catch message unpack exceptions and pass them to the callback
// in the expected manner to avoid propagating them up the call
@ -641,17 +641,7 @@ namespace sdbus {
tuple_of_function_input_arg_types_t<_Function> signalArgs;
// Deserialize input arguments from the signal message into the tuple
try
{
signal >> signalArgs;
}
catch (const sdbus::Error& e)
{
// The convenience API callback cannot handle an incoming signal with
// an unexpected payload, so catch and ignore this exception to avoid
// propagating it up the call stack to the event loop.
return;
}
signal >> signalArgs;
// Invoke callback with input arguments from the tuple.
sdbus::apply(callback, signalArgs);