aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-3gpp-ussd.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2023-10-26 10:54:17 +0000
committerAleksander Morgado <aleksander@aleksander.es>2023-10-27 11:34:26 +0200
commit1f9a04268f6de7e9aa11073f0bf363aadc2ca29b (patch)
tree64519e385d67a5a9353681ddd39b15e979d5ead0 /src/mm-iface-modem-3gpp-ussd.c
parent9569b99f4197ca4de57a97840a573304389fbc11 (diff)
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.
Diffstat (limited to 'src/mm-iface-modem-3gpp-ussd.c')
-rw-r--r--src/mm-iface-modem-3gpp-ussd.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/mm-iface-modem-3gpp-ussd.c b/src/mm-iface-modem-3gpp-ussd.c
index 33f49f0e..520065ee 100644
--- a/src/mm-iface-modem-3gpp-ussd.c
+++ b/src/mm-iface-modem-3gpp-ussd.c
@@ -26,6 +26,7 @@
#include "mm-iface-modem-3gpp-ussd.h"
#include "mm-base-modem.h"
#include "mm-modem-helpers.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#define SUPPORT_CHECKED_TAG "3gpp-ussd-support-checked-tag"
@@ -68,7 +69,7 @@ handle_cancel_ready (MMIfaceModem3gppUssd *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->cancel_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_modem3gpp_ussd_complete_cancel (ctx->skeleton, ctx->invocation);
@@ -83,7 +84,7 @@ handle_cancel_auth_ready (MMBaseModem *self,
GError *error = NULL;
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_cancel_context_free (ctx);
return;
}
@@ -153,7 +154,7 @@ handle_respond_ready (MMIfaceModem3gppUssd *self,
reply = MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->send_finish (self, res, &error);
if (!reply)
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
mm_gdbus_modem3gpp_ussd_complete_respond (ctx->skeleton,
ctx->invocation,
@@ -171,7 +172,7 @@ handle_respond_auth_ready (MMBaseModem *self,
GError *error = NULL;
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_respond_context_free (ctx);
return;
}
@@ -189,11 +190,8 @@ handle_respond_auth_ready (MMBaseModem *self,
switch (mm_gdbus_modem3gpp_ussd_get_state (ctx->skeleton)) {
case MM_MODEM_3GPP_USSD_SESSION_STATE_ACTIVE:
case MM_MODEM_3GPP_USSD_SESSION_STATE_IDLE:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot respond USSD: "
- "no active session");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot respond USSD: no active session");
break;
case MM_MODEM_3GPP_USSD_SESSION_STATE_USER_RESPONSE:
@@ -265,7 +263,7 @@ handle_initiate_ready (MMIfaceModem3gppUssd *self,
reply = MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->send_finish (self, res, &error);
if (!reply)
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
mm_gdbus_modem3gpp_ussd_complete_initiate (ctx->skeleton,
ctx->invocation,
@@ -283,7 +281,7 @@ handle_initiate_auth_ready (MMBaseModem *self,
GError *error = NULL;
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_initiate_context_free (ctx);
return;
}
@@ -301,11 +299,8 @@ handle_initiate_auth_ready (MMBaseModem *self,
switch (mm_gdbus_modem3gpp_ussd_get_state (ctx->skeleton)) {
case MM_MODEM_3GPP_USSD_SESSION_STATE_ACTIVE:
case MM_MODEM_3GPP_USSD_SESSION_STATE_USER_RESPONSE:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot initiate USSD: "
- "a session is already active");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot initiate USSD: a session is already active");
break;
case MM_MODEM_3GPP_USSD_SESSION_STATE_IDLE: