1 // Take a look at the license at the top of the repository in the LICENSE file. 2 3 use crate::DBusMethodInvocation; 4 use glib::error::ErrorDomain; 5 use glib::translate::*; 6 7 impl DBusMethodInvocation { 8 #[doc(alias = "g_dbus_method_invocation_return_error_literal")] return_error<T: ErrorDomain>(&self, error: T, message: &str)9 pub fn return_error<T: ErrorDomain>(&self, error: T, message: &str) { 10 unsafe { 11 ffi::g_dbus_method_invocation_return_error_literal( 12 self.to_glib_full(), 13 T::domain().into_glib(), 14 error.code(), 15 message.to_glib_none().0, 16 ); 17 } 18 } 19 20 #[doc(alias = "g_dbus_method_invocation_return_gerror")] return_gerror(&self, error: glib::Error)21 pub fn return_gerror(&self, error: glib::Error) { 22 unsafe { 23 ffi::g_dbus_method_invocation_return_gerror( 24 self.to_glib_full(), 25 error.to_glib_none().0, 26 ); 27 } 28 } 29 } 30