Fix coroutine_method_instance error handling
Unlike other methods (method_handler, get/set handlers)
coroutine_method_instance did not catch exception_t which was causing
wrong error to be send in response. This commit fixes this issue.
Tested:
- Throw exception from register_method(boost::asio::yield_context...),
message that was captured using busctl monitor contains proper error
information after this change.
Change-Id: Ia7e8ef5fb010a3da0f80c2404da59b0da555d2ef
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/include/sdbusplus/asio/object_server.hpp b/include/sdbusplus/asio/object_server.hpp
index 181c26d..7260cc4 100644
--- a/include/sdbusplus/asio/object_server.hpp
+++ b/include/sdbusplus/asio/object_server.hpp
@@ -194,6 +194,10 @@
// Catch D-Bus error explicitly called by method handler
err = mcpy.new_method_errno(e.get_errno(), e.get_error());
}
+ catch (const sdbusplus::exception_t& e)
+ {
+ err = mcpy.new_method_error(e);
+ }
catch (...)
{
err = mcpy.new_method_errno(-EIO);