dbus_interface requires zbus::fdo::Error
I tried to implement a DBus interface with the dbus_interface
macro, and then return custom errors. I declared
use zbus::DBusError;
#[derive(DBusError, Debug)]
#[dbus_error(prefix = "foo.Error")]
pub enum Error {
ZBus(zbus::Error),
ThingsFailed(String),
}
pub type Result<T> = std::result::Result<T, Error>;
But attempting to use the Result
as return type for a method inside a dbus_interface
impl
made the compiler complain about a missing From
from Error
to zbus::fdo::Error
.
When adding that From
the code compiles but the custom error type is lost; returning an error from my method ends up in a org.freedesktop.DBus.Error
instead of my custom error name.
I was assuming it ought to work because Interface::call
returns a generic zbus::Error
, but I wasn't able to make it work, so do I understand correctly that currently we can't use custom errors with dbus_interface
?
If not what am I doing wrong?