seed r221 - trunk/libseed



Author: racarr
Date: Sun Nov  9 08:29:08 2008
New Revision: 221
URL: http://svn.gnome.org/viewvc/seed?rev=221&view=rev

Log:
Exceptions in instance/class init closures.


Modified:
   trunk/libseed/seed-gtype.c

Modified: trunk/libseed/seed-gtype.c
==============================================================================
--- trunk/libseed/seed-gtype.c	(original)
+++ trunk/libseed/seed-gtype.c	Sun Nov  9 08:29:08 2008
@@ -31,12 +31,18 @@
     JSObjectRef function = (JSObjectRef) userdata;
     JSValueRef jsargs[2];
     GType type;
+    JSValueRef exception = 0;
 
     type = (GType) JSObjectGetPrivate(*(JSObjectRef *) args[1]);
     jsargs[0] = seed_make_struct(*(gpointer *) args[0], 0);
     jsargs[1] = seed_gobject_get_prototype_for_gtype(type);
 
     JSObjectCallAsFunction(eng->context, function, 0, 2, jsargs, 0);
+    if (exception)
+    {
+	gchar * mes = seed_exception_to_string(exception);
+	g_warning("Exception in class init closure. %s \n", mes, 0);
+    }
 }
 
 static void
@@ -45,13 +51,21 @@
 {
     JSObjectRef function = (JSObjectRef) userdata;
     JSValueRef jsargs;
+    JSValueRef exception = 0;
     JSObjectRef this_object;
 
     jsargs = seed_make_struct(*(gpointer *) args[1], 0);
     this_object =
 	(JSObjectRef) seed_value_from_object(*(GObject **) args[0], 0);
 
-    JSObjectCallAsFunction(eng->context, function, this_object, 1, &jsargs, 0);
+    JSObjectCallAsFunction(eng->context, function, this_object, 1, &jsargs, &exception);
+    if (exception)
+    {
+	gchar * mes = seed_exception_to_string(exception);
+	g_warning("Exception in instance init closure. %s \n", mes, 0);
+    }
+    
+    
 }
 
 static ffi_closure *seed_make_class_init_closure(JSObjectRef function)



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