);
}
-
-static int get_dbus_error_mapping_to_subsession_error(const char *dbus_error)
+static subsession_error_e errstr_to_errcode(const char *dbus_error)
{
size_t arr_size = sizeof(error_mappings) / sizeof(error_mappings[0]);
return SUBSESSION_ERROR_IO_ERROR;
}
-static subsession_error_e map_dbus_call_error_to_return_value(const GError *error)
+static subsession_error_e gerror_to_errcode(const GError *error)
{
if (!error)
return SUBSESSION_ERROR_NONE;
}
if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_DBUS_ERROR) {
- return get_dbus_error_mapping_to_subsession_error(error->message);
+ return errstr_to_errcode(error->message);
}
return SUBSESSION_ERROR_IO_ERROR;
if (!retgv || call_sync_error) {
LOGE("Error while calling DBus method %s: %s", method, g_dbus_error_get_remote_error(call_sync_error));
- int err = map_dbus_call_error_to_return_value(call_sync_error);
- log_if_error_(err)
g_error_free(call_sync_error);
- return err;
+ return gerror_to_errcode(call_sync_error);
}
if (out)
g_autoptr(GError) g_err = NULL;
// ret's GVariant is unused, we are interested only if method call resulted in error or not
g_autoptr(GVariant) ret = g_dbus_connection_call_finish(connection, res, &g_err);
- subsession_error_e s_err = map_dbus_call_error_to_return_value(g_err);
+ subsession_error_e s_err = gerror_to_errcode(g_err);
if (g_err)
LOGI("DBus method call returned error: %s (SUBSESSION_ERROR code: %d)", g_dbus_error_get_remote_error(g_err), s_err);