[tracker/gdbus-evolution: 21/28] functional-test: Simplify error handling in query tests



commit 29feb597ebc1beb64d8da29a423b8eb6a4a1df6d
Author: Jürg Billeter <j bitron ch>
Date:   Mon Oct 25 14:41:24 2010 +0200

    functional-test: Simplify error handling in query tests

 tests/functional-tests/bus-query-test.vala    |    9 +++++++--
 tests/functional-tests/direct-query-test.vala |   18 +++++++++---------
 2 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/tests/functional-tests/bus-query-test.vala b/tests/functional-tests/bus-query-test.vala
index 1867fed..d8a198e 100644
--- a/tests/functional-tests/bus-query-test.vala
+++ b/tests/functional-tests/bus-query-test.vala
@@ -4,7 +4,12 @@ using Tracker.Sparql;
 int
 main( string[] args )
 {
-	TestApp app = new TestApp (new  Tracker.Bus.Connection ());
+	try {
+		TestApp app = new TestApp (new  Tracker.Bus.Connection ());
 
-	return app.run ();
+		return app.run ();
+	} catch (GLib.Error e) {
+		warning ("Couldn't perform test: %s", e.message);
+		return 1;
+	}
 }
diff --git a/tests/functional-tests/direct-query-test.vala b/tests/functional-tests/direct-query-test.vala
index 4c87cf7..ddf7048 100644
--- a/tests/functional-tests/direct-query-test.vala
+++ b/tests/functional-tests/direct-query-test.vala
@@ -12,7 +12,11 @@ private void test_async () {
 		print ("Getting connection asynchronously\n");
 		loop = new MainLoop (null, false);
 		Connection.get_async.begin (null, (o, res) => {
-			c = Connection.get_async.end (res);
+			try {
+				c = Connection.get_async.end (res);
+			} catch (GLib.Error e) {
+				warning ("Couldn't perform test: %s", e.message);
+			}
 			loop.quit ();
 		});
 		loop.run ();
@@ -24,10 +28,8 @@ private void test_async () {
 
 		print ("Running app\n");
 		res = app.run();
-	} catch (GLib.IOError e1) {
-		warning ("Couldn't perform test: %s", e1.message);
-	} catch (Tracker.Sparql.Error e2) {
-		warning ("Couldn't perform test: %s", e2.message);
+	} catch (GLib.Error e) {
+		warning ("Couldn't perform test: %s", e.message);
 	}
 
 	print ("\n");
@@ -48,10 +50,8 @@ private void test_sync () {
 
 		print ("Running app\n");
 		res = app.run();
-	} catch (GLib.IOError e1) {
-		warning ("Couldn't perform test: %s", e1.message);
-	} catch (Tracker.Sparql.Error e2) {
-		warning ("Couldn't perform test: %s", e2.message);
+	} catch (GLib.Error e) {
+		warning ("Couldn't perform test: %s", e.message);
 	}
 
 	print ("\n");



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