seed r80 - trunk/libseed



Author: racarr
Date: Mon Nov  3 09:42:51 2008
New Revision: 80
URL: http://svn.gnome.org/viewvc/seed?rev=80&view=rev

Log:
Propogate exception when failing to import a namespace.


Modified:
   trunk/libseed/seed-engine.c
   trunk/libseed/seed-engine.h

Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c	(original)
+++ trunk/libseed/seed-engine.c	Mon Nov  3 09:42:51 2008
@@ -30,7 +30,7 @@
 GParamSpec ** global_prop_cache;
 
 
-static void seed_make_exception(JSValueRef * exception, 
+void seed_make_exception(JSValueRef * exception, 
 								gchar * name, gchar * message)
 {
 		JSStringRef js_name = 0;
@@ -591,7 +591,23 @@
 	
 		if(!g_irepository_require (g_irepository_get_default (), namespace,
 								   version, 0, NULL))
-				g_error("No namespace: %s \n", namespace);
+		{
+				gchar * mes;
+				if (!version)
+				{
+						mes = g_strdup_printf("No such namespace: %s", 
+											  namespace);
+				}
+				else
+				{
+						mes =
+					    g_strdup_printf("No such namespace: %s (version %s)", 
+										namespace, version);
+				}
+				seed_make_exception(exception, "NamespaceError",mes);
+				return JSValueMakeNull(eng->context);
+		}
+
 
 		n = g_irepository_get_n_infos(g_irepository_get_default(),
 									  namespace);

Modified: trunk/libseed/seed-engine.h
==============================================================================
--- trunk/libseed/seed-engine.h	(original)
+++ trunk/libseed/seed-engine.h	Mon Nov  3 09:42:51 2008
@@ -42,4 +42,6 @@
 
 void seed_gobject_define_property_from_function_info(GIFunctionInfo *info, JSObjectRef object, gboolean instance);
 void seed_create_function(char * name, gpointer func, JSObjectRef obj);
+void seed_make_exception(JSValueRef * exception, 
+						 gchar * name, gchar * message);
 #endif



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