Skip to content

Commit

Permalink
Use DBus erors
Browse files Browse the repository at this point in the history
  • Loading branch information
swsnr committed Jan 23, 2025
1 parent f434cfd commit 134a6b8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/dbus/searchprovider2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use glib::Variant;
use gtk::{
gio::{DBusInterfaceInfo, DBusNodeInfo, IOErrorEnum},
gio::{DBusError, DBusInterfaceInfo, DBusNodeInfo},
prelude::DBusMethodCall,
};

Expand Down Expand Up @@ -68,10 +68,7 @@ pub enum MethodCall {
}

fn invalid_parameters() -> glib::Error {
glib::Error::new(
IOErrorEnum::InvalidArgument,
"Invalid parameters for method",
)
glib::Error::new(DBusError::InvalidArgs, "Invalid parameters for method")
}

impl DBusMethodCall for MethodCall {
Expand All @@ -83,7 +80,7 @@ impl DBusMethodCall for MethodCall {
) -> Result<Self, glib::Error> {
if interface != Some(INTERFACE_NAME) {
return Err(glib::Error::new(
IOErrorEnum::InvalidArgument,
DBusError::UnknownInterface,
"Unexpected interface",
));
}
Expand All @@ -109,7 +106,7 @@ impl DBusMethodCall for MethodCall {
.map(MethodCall::LaunchSearch)
.ok_or_else(invalid_parameters),
_ => Err(glib::Error::new(
IOErrorEnum::InvalidArgument,
DBusError::UnknownMethod,
"Unexpected method",
)),
}
Expand Down

0 comments on commit 134a6b8

Please sign in to comment.