mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
gdbus tool: print GVariant errors in context
Use g_variant_parse_error_print_context() to format the error message from the GVariant parser. There is a slightly dubious interaction with the "parse me harder" functionality here. We're probably going to have to deal with that separately. https://bugzilla.gnome.org/show_bug.cgi?id=715028
This commit is contained in:
parent
94a89f6c2f
commit
ee5dab6bb5
@ -671,18 +671,24 @@ handle_emit (gint *argc,
|
||||
&error);
|
||||
if (value == NULL)
|
||||
{
|
||||
gchar *context;
|
||||
|
||||
context = g_variant_parse_error_print_context (error, (*argv)[n]);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
value = _g_variant_parse_me_harder (NULL, (*argv)[n], &error);
|
||||
if (value == NULL)
|
||||
{
|
||||
/* Use the original non-"parse-me-harder" error */
|
||||
g_printerr (_("Error parsing parameter %d: %s\n"),
|
||||
n,
|
||||
error->message);
|
||||
context);
|
||||
g_error_free (error);
|
||||
g_free (context);
|
||||
g_variant_builder_clear (&builder);
|
||||
goto out;
|
||||
}
|
||||
g_free (context);
|
||||
}
|
||||
g_variant_builder_add_value (&builder, value);
|
||||
}
|
||||
@ -973,6 +979,9 @@ handle_call (gint *argc,
|
||||
&error);
|
||||
if (value == NULL)
|
||||
{
|
||||
gchar *context;
|
||||
|
||||
context = g_variant_parse_error_print_context (error, (*argv)[n]);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
value = _g_variant_parse_me_harder (type, (*argv)[n], &error);
|
||||
@ -984,19 +993,21 @@ handle_call (gint *argc,
|
||||
g_printerr (_("Error parsing parameter %d of type '%s': %s\n"),
|
||||
n,
|
||||
s,
|
||||
error->message);
|
||||
context);
|
||||
g_free (s);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printerr (_("Error parsing parameter %d: %s\n"),
|
||||
n,
|
||||
error->message);
|
||||
context);
|
||||
}
|
||||
g_error_free (error);
|
||||
g_variant_builder_clear (&builder);
|
||||
g_free (context);
|
||||
goto out;
|
||||
}
|
||||
g_free (context);
|
||||
}
|
||||
g_variant_builder_add_value (&builder, value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user