Skip to content

Commit

Permalink
Use DBus errors in example
Browse files Browse the repository at this point in the history
  • Loading branch information
swsnr committed Jan 23, 2025
1 parent 00fe956 commit 054d9e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/gio_dbus_register_object/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod imp {

use gio::prelude::*;
use gio::subclass::prelude::*;
use gio::{DBusConnection, IOErrorEnum};
use gio::{DBusConnection, DBusError};

const EXAMPLE_XML: &str = r#"
<node>
Expand Down Expand Up @@ -71,10 +71,10 @@ mod imp {
"Hello" => Ok(params.get::<Hello>().map(Self::Hello)),
"SlowHello" => Ok(params.get::<SlowHello>().map(Self::SlowHello)),
"GoodBye" => Ok(Some(Self::GoodBye)),
_ => Err(glib::Error::new(IOErrorEnum::Failed, "No such method")),
_ => Err(glib::Error::new(DBusError::UnknownMethod, "No such method")),
}
.and_then(|p| {
p.ok_or_else(|| glib::Error::new(IOErrorEnum::Failed, "Invalid parameters"))
p.ok_or_else(|| glib::Error::new(DBusError::InvalidArgs, "Invalid parameters"))
})
}
}
Expand Down

0 comments on commit 054d9e2

Please sign in to comment.