[glide] Some rudimentary error handling for saving JSON



commit 25599ba95177f4e098da06815e74a31384567a12
Author: Robert Carr <racarr Valentine localdomain>
Date:   Thu Apr 29 07:57:32 2010 -0400

    Some rudimentary error handling for saving JSON

 src/glide-document.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/glide-document.c b/src/glide-document.c
index 181127a..ad8c126 100644
--- a/src/glide-document.c
+++ b/src/glide-document.c
@@ -461,6 +461,7 @@ glide_document_write_archive (GlideDocument *d)
 void
 glide_document_write_json (GlideDocument *d)
 {
+  GError *e = NULL;
   JsonNode *node;
   JsonGenerator *gen;
   gchar *json_path;
@@ -476,7 +477,12 @@ glide_document_write_json (GlideDocument *d)
   json_path = g_strdup_printf("%s/document.json",d->priv->working_path);
   
   // TODO: Error
-  json_generator_to_file (gen, json_path, NULL);
+  json_generator_to_file (gen, json_path, &e);
+  if (e)
+    {
+      g_warning ("Failed to write JSON to file (%s): %s", json_path, e->message);
+      g_error_free (e);
+    }
   
   g_object_unref (G_OBJECT (gen));
   g_free (json_path);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]