[gimp/gimp-2-10] app: better error management.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: better error management.
- Date: Thu, 6 Feb 2020 23:15:52 +0000 (UTC)
commit 0a2ddbca3ddfc2744a897c8a2f36384344882328
Author: Jehan <jehan girinstud io>
Date: Sun Jan 26 15:10:44 2020 +0100
app: better error management.
- Clear the GError when relevant.
- Check result of json_path_compile() just in case.
- Print some error on stderr when parsing of gimp_versions.json fails
(which should never happen on releases but would help during
development).
(cherry picked from commit 8528759834a694cfbf09fd38bdf8fe5bc5feeff7)
app/gimp-update.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/app/gimp-update.c b/app/gimp-update.c
index 966b3dc0d9..bfe84dbd79 100644
--- a/app/gimp-update.c
+++ b/app/gimp-update.c
@@ -112,8 +112,13 @@ gimp_check_updates_callback (GObject *source,
parser = json_parser_new ();
if (! json_parser_load_from_stream (parser, G_INPUT_STREAM (stream), NULL, &error))
{
+#ifdef GIMP_UNSTABLE
+ g_printerr("Parsing of %s failed: %s\n",
+ g_file_get_uri (G_FILE (source)), error->message);
+#endif
g_clear_object (&stream);
g_clear_object (&parser);
+ g_clear_error (&error);
return;
}
@@ -128,7 +133,17 @@ gimp_check_updates_callback (GObject *source,
* Unfortunately json-glib does not support filter syntax, so we
* end up looping through releases.
*/
- json_path_compile (path, "$['STABLE'][*]", &error);
+ if (! json_path_compile (path, "$['STABLE'][*]", &error))
+ {
+#ifdef GIMP_UNSTABLE
+ g_printerr("Path compilation failed: %s\n", error->message);
+#endif
+ g_clear_object (&stream);
+ g_clear_object (&parser);
+ g_clear_error (&error);
+
+ return;
+ }
result = json_path_match (path, json_parser_get_root (parser));
g_return_if_fail (JSON_NODE_HOLDS_ARRAY (result));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]