[byzanz] Improve error handling of session



commit 1c6a7d9e771ee97f42bcb2475d5136a173e4cbc8
Author: Benjamin Otte <otte gnome org>
Date:   Sun Aug 30 19:00:03 2009 +0200

    Improve error handling of session
    
    - Delete the recorded file on encoder error
    - Don't forward the encoder's CANCELLED error to the session - it is
      reuqested behavior after all.

 src/byzanzsession.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/byzanzsession.c b/src/byzanzsession.c
index bbce83d..356b9e5 100644
--- a/src/byzanzsession.c
+++ b/src/byzanzsession.c
@@ -140,8 +140,14 @@ byzanz_session_encoder_notify_cb (ByzanzEncoder * encoder,
   if (g_str_equal (pspec->name, "running")) {
     g_object_notify (G_OBJECT (session), "encoding");
   } else if (g_str_equal (pspec->name, "error")) {
-    byzanz_session_set_error (session,
-        byzanz_encoder_get_error (encoder));
+    const GError *error = byzanz_encoder_get_error (encoder);
+
+    /* Cancellation is not an error, it's been requested via _abort() */
+    if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+      byzanz_session_set_error (session, error);
+
+    /* Delete the file, it's broken after all. Don't throw errors if it fails though. */
+    g_file_delete (session->file, NULL, NULL);
   }
 }
 



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