[gitg] Handle request errors



commit 9cec58185a85d5fe3b0fe40fc4d29eb3e1f138a4
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sat Dec 28 15:46:03 2013 +0100

    Handle request errors

 libgitg/Makefile.am                 |    2 ++
 libgitg/gitg-diff-view-request.vala |   17 +++++++++++++++--
 vapi/webkit2gtk-3.0.vapi            |    1 +
 3 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/libgitg/Makefile.am b/libgitg/Makefile.am
index 40f725f..6036b72 100644
--- a/libgitg/Makefile.am
+++ b/libgitg/Makefile.am
@@ -60,8 +60,10 @@ VALA_FILES =                                 \
        gitg-diff-view-request-resource.vala    \
        gitg-diff-view-request-patch.vala       \
        gitg-diff-view-request-diff.vala        \
+       gitg-diff-view-request-stage.vala       \
        gitg-repository-list-box.vala           \
        gitg-when-mapped.vala                   \
+       gitg-patch-set.vala                     \
        gitg-progress-bin.vala                  \
        gitg-stage.vala                         \
        gitg-stage-status-enumerator.vala       \
diff --git a/libgitg/gitg-diff-view-request.vala b/libgitg/gitg-diff-view-request.vala
index c70d671..00dc027 100644
--- a/libgitg/gitg-diff-view-request.vala
+++ b/libgitg/gitg-diff-view-request.vala
@@ -90,6 +90,7 @@ namespace Gitg
                {
                        SourceFunc callback = run_impl.callback;
                        InputStream? ret = null;
+                       Error? err = null;
 
                        new Thread<void*>("gitg-gtk-diff-view", () => {
                                // Actually do it
@@ -97,7 +98,10 @@ namespace Gitg
                                {
                                        ret = run_async(cancellable);
                                }
-                               catch {}
+                               catch (Error e)
+                               {
+                                       err = e;
+                               }
 
                                // Schedule the callback in idle
                                Idle.add((owned)callback);
@@ -107,6 +111,11 @@ namespace Gitg
                        // Wait for it to finish, yield to caller
                        yield;
 
+                       if (err != null)
+                       {
+                               throw err;
+                       }
+
                        // Return the input stream
                        return ret;
                }
@@ -120,7 +129,11 @@ namespace Gitg
                                {
                                        stream = run_impl.end(res);
                                }
-                               catch {}
+                               catch (Error e)
+                               {
+                                       d_request.finish_error(e);
+                                       return;
+                               }
 
                                if (stream == null)
                                {
diff --git a/vapi/webkit2gtk-3.0.vapi b/vapi/webkit2gtk-3.0.vapi
index 34766bd..d2a0b57 100644
--- a/vapi/webkit2gtk-3.0.vapi
+++ b/vapi/webkit2gtk-3.0.vapi
@@ -407,6 +407,7 @@ namespace WebKit {
                [CCode (has_construct_function = false)]
                protected URISchemeRequest ();
                public void finish (GLib.InputStream stream, int64 stream_length, string? mime_type);
+               public void finish_error (GLib.Error error);
                public unowned string get_path ();
                public unowned string get_scheme ();
                public unowned string get_uri ();


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