From 1f9a04268f6de7e9aa11073f0bf363aadc2ca29b Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 26 Oct 2023 10:54:17 +0000 Subject: core: ensure all errors returned in DBus operations are normalized We want to ensure that all errors reported via DBus operations are normalized to MM-specific errors. We don't want to return QMI or MBIM specific errors, as those are protocol specific and we don't want DBus clients to need to rely on knowing which is the protocol in use by the device. --- src/mm-iface-modem-signal.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/mm-iface-modem-signal.c') diff --git a/src/mm-iface-modem-signal.c b/src/mm-iface-modem-signal.c index fe7d0c7a..68c45ec6 100644 --- a/src/mm-iface-modem-signal.c +++ b/src/mm-iface-modem-signal.c @@ -20,6 +20,7 @@ #include "mm-iface-modem.h" #include "mm-iface-modem-signal.h" +#include "mm-error-helpers.h" #include "mm-log-object.h" #define SUPPORT_CHECKED_TAG "signal-support-checked-tag" @@ -380,7 +381,7 @@ handle_setup_auth_ready (MMBaseModem *_self, Private *priv; if (!mm_base_modem_authorize_finish (_self, res, &error)) { - g_dbus_method_invocation_take_error (ctx->invocation, error); + mm_dbus_method_invocation_take_error (ctx->invocation, error); handle_setup_context_free (ctx); return; } @@ -455,7 +456,7 @@ setup_thresholds_restart_ready (MMIfaceModemSignal *self, if (!thresholds_restart_finish (self, res, &error)) { priv->rssi_threshold = ctx->previous_rssi_threshold; priv->error_rate_threshold = ctx->previous_error_rate_threshold; - g_dbus_method_invocation_take_error (ctx->invocation, error); + mm_dbus_method_invocation_take_error (ctx->invocation, error); } else { check_interface_reset (self); mm_gdbus_modem_signal_set_rssi_threshold (ctx->skeleton, priv->rssi_threshold); @@ -481,15 +482,15 @@ handle_setup_thresholds_auth_ready (MMBaseModem *_self, priv = get_private (self); if (!mm_base_modem_authorize_finish (_self, res, &error)) { - g_dbus_method_invocation_take_error (ctx->invocation, error); + mm_dbus_method_invocation_take_error (ctx->invocation, error); handle_setup_thresholds_context_free (ctx); return; } if (!MM_IFACE_MODEM_SIGNAL_GET_INTERFACE (self)->setup_thresholds || !MM_IFACE_MODEM_SIGNAL_GET_INTERFACE (self)->setup_thresholds_finish) { - g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED, - "Cannot setup thresholds: operation not supported"); + mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED, + "Cannot setup thresholds: operation not supported"); handle_setup_thresholds_context_free (ctx); return; } @@ -503,7 +504,7 @@ handle_setup_thresholds_auth_ready (MMBaseModem *_self, properties = mm_signal_threshold_properties_new_from_dictionary (ctx->settings, &error); if (!properties) { - g_dbus_method_invocation_take_error (ctx->invocation, error); + mm_dbus_method_invocation_take_error (ctx->invocation, error); handle_setup_thresholds_context_free (ctx); return; } -- cgit v1.2.3-70-g09d2