diff options
Diffstat (limited to 'libmm-glib')
-rw-r--r-- | libmm-glib/mm-bearer-properties.c | 4 | ||||
-rw-r--r-- | libmm-glib/mm-simple-connect-properties.c | 18 |
2 files changed, 17 insertions, 5 deletions
diff --git a/libmm-glib/mm-bearer-properties.c b/libmm-glib/mm-bearer-properties.c index 3d1b45b4..5ed4438e 100644 --- a/libmm-glib/mm-bearer-properties.c +++ b/libmm-glib/mm-bearer-properties.c @@ -514,8 +514,8 @@ mm_bearer_properties_consume_string (MMBearerProperties *self, } else { g_set_error (error, MM_CORE_ERROR, - MM_CORE_ERROR_INVALID_ARGS, - "Invalid properties string, unexpected key '%s'", + MM_CORE_ERROR_UNSUPPORTED, + "Invalid properties string, unsupported key '%s'", key); return FALSE; } diff --git a/libmm-glib/mm-simple-connect-properties.c b/libmm-glib/mm-simple-connect-properties.c index f8649b55..5b9af11a 100644 --- a/libmm-glib/mm-simple-connect-properties.c +++ b/libmm-glib/mm-simple-connect-properties.c @@ -490,20 +490,32 @@ key_value_foreach (const gchar *key, const gchar *value, ParseKeyValueContext *ctx) { + GError *inner_error = NULL; + /* First, check if we can consume this as bearer properties */ if (mm_bearer_properties_consume_string (ctx->self->priv->bearer_properties, key, value, - NULL)) + &inner_error)) return TRUE; + /* Unknown keys are reported as unsupported. Any other error is right away + * fatal (e.g. an invalid value given to a known bearer property) */ + if (!g_error_matches (inner_error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED)) { + ctx->error = inner_error; + return FALSE; + } + + /* On unsupported errors, try with the Simple.Connect specific properties */ + g_clear_error (&inner_error); + if (g_str_equal (key, PROPERTY_PIN)) mm_simple_connect_properties_set_pin (ctx->self, value); else if (g_str_equal (key, PROPERTY_OPERATOR_ID)) mm_simple_connect_properties_set_operator_id (ctx->self, value); else { ctx->error = g_error_new (MM_CORE_ERROR, - MM_CORE_ERROR_INVALID_ARGS, - "Invalid properties string, unexpected key '%s'", + MM_CORE_ERROR_UNSUPPORTED, + "Invalid properties string, unsupported key '%s'", key); } |