[gitg/wip/clone] Catch possible errors cloning the repository



commit 7eb7ee34ee9991f36a38db452a3910bf9ea06af8
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu Mar 21 20:52:13 2013 +0100

    Catch possible errors cloning the repository

 libgitg-gtk/gitg-gtk-dash-view.vala |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/libgitg-gtk/gitg-gtk-dash-view.vala b/libgitg-gtk/gitg-gtk-dash-view.vala
index d291b20..ce871ad 100644
--- a/libgitg-gtk/gitg-gtk-dash-view.vala
+++ b/libgitg-gtk/gitg-gtk-dash-view.vala
@@ -265,7 +265,14 @@ namespace GitgGtk
                                {
                                        repository = Ggit.Repository.clone(url, location, null) as 
Gitg.Repository;
                                }
-                               catch {}
+                               catch (Ggit.Error e)
+                               {
+                                       warning("error cloning: %s", e.message);
+                               }
+                               catch (GLib.Error e)
+                               {
+                                       warning("error cloning: %s", e.message);
+                               }
 
                                Idle.add((owned) callback);
                                return null;
@@ -287,16 +294,20 @@ namespace GitgGtk
 
                        clone.begin(url, location, (obj, res) => {
                                Gitg.Repository? repository = clone.end(res);
-
-                               Gitg.Ref? head = null;
                                string branch_name = "";
 
-                               try
+                               // FIXME: show an error
+                               if (repository != null)
                                {
-                                       head = repository.get_head();
-                                       branch_name = head.parsed_name.shortname;
+                                       Gitg.Ref? head = null;
+
+                                       try
+                                       {
+                                               head = repository.get_head();
+                                               branch_name = head.parsed_name.shortname;
+                                       }
+                                       catch {}
                                }
-                               catch {}
 
                                data.repository = repository;
                                data.branch_label.set_markup("<small>%s</small>".printf(branch_name));


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