[tracker] tracker-needle: Simplify error handling



commit d273fd5d2a911a8252bd9f0186768954db6e9f86
Author: Jürg Billeter <j bitron ch>
Date:   Thu Mar 31 15:36:10 2011 +0200

    tracker-needle: Simplify error handling

 src/tracker-needle/tracker-query.vala   |   26 ++++++--------------------
 src/tracker-needle/tracker-taglist.vala |   17 ++++-------------
 2 files changed, 10 insertions(+), 33 deletions(-)
---
diff --git a/src/tracker-needle/tracker-query.vala b/src/tracker-needle/tracker-query.vala
index 399b492..f92daa2 100644
--- a/src/tracker-needle/tracker-query.vala
+++ b/src/tracker-needle/tracker-query.vala
@@ -136,12 +136,8 @@ public class Tracker.Query {
 
 		try {
 			connection = Sparql.Connection.get ();
-		} catch (Sparql.Error ea) {
-			warning ("Could not get Sparql connection: %s", ea.message);
-		} catch (GLib.IOError eb) {
-			warning ("Could not get Sparql connection: %s", eb.message);
-		} catch (GLib.DBusError ec) {
-			warning ("Could not get Sparql connection: %s", ec.message);
+		} catch (GLib.Error e) {
+			warning ("Could not get Sparql connection: %s", e.message);
 		}
 	}
 
@@ -162,14 +158,8 @@ public class Tracker.Query {
 		try {
 			cursor = yield connection.query_async (query, null);
                         yield cursor.next_async ();
-		} catch (Sparql.Error ea) {
-			warning ("Could not run Sparql count query: %s", ea.message);
-		} catch (GLib.IOError eb) {
-			warning ("Could not run Sparql count query: %s", eb.message);
-		} catch (GLib.DBusError ec) {
-			warning ("Could not run Sparql count query: %s", ec.message);
-		} catch (GLib.Error ge) {
-			warning ("Could not run Sparql count query: %s", ge.message);
+		} catch (GLib.Error e) {
+			warning ("Could not run Sparql count query: %s", e.message);
                 }
 
                 return (uint) cursor.get_integer (0);
@@ -200,12 +190,8 @@ public class Tracker.Query {
 
 		try {
 			cursor = yield connection.query_async (query, null);
-		} catch (Sparql.Error ea) {
-			warning ("Could not run Sparql query: %s", ea.message);
-		} catch (GLib.IOError eb) {
-			warning ("Could not run Sparql query: %s", eb.message);
-		} catch (GLib.DBusError ec) {
-			warning ("Could not run Sparql query: %s", ec.message);
+		} catch (GLib.Error e) {
+			warning ("Could not run Sparql query: %s", e.message);
 		}
 
 		debug ("Done");
diff --git a/src/tracker-needle/tracker-taglist.vala b/src/tracker-needle/tracker-taglist.vala
index a357560..c690c2c 100644
--- a/src/tracker-needle/tracker-taglist.vala
+++ b/src/tracker-needle/tracker-taglist.vala
@@ -77,14 +77,9 @@ public class Tracker.TagList : ScrolledWindow {
 		// Add data
 		try {
 			connection = Sparql.Connection.get ();
-		} catch (Sparql.Error ea) {
-			warning ("Could not get Sparql connection: %s", ea.message);
+		} catch (GLib.Error e) {
+			warning ("Could not get Sparql connection: %s", e.message);
 			return;
-		} catch (GLib.IOError eb) {
-			warning ("Could not get Sparql connection: %s", eb.message);
-			return;
-		} catch (GLib.DBusError ec) {
-			warning ("Could not run Sparql query: %s", ec.message);
 		}
 
 		get_tags.begin ();
@@ -137,12 +132,8 @@ public class Tracker.TagList : ScrolledWindow {
 				           3, cursor.get_string (3),      // Count
 				           -1);
 			}
-		} catch (Sparql.Error ea) {
-			warning ("Could not run Sparql query: %s", ea.message);
-		} catch (GLib.IOError eb) {
-			warning ("Could not run Sparql query: %s", eb.message);
-		} catch (GLib.Error ec) {
-			warning ("Could not run Sparql query: %s", ec.message);
+		} catch (GLib.Error e) {
+			warning ("Could not run Sparql query: %s", e.message);
 		}
 
 		debug ("  Done");



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