[macruby-changes] [3373] MacRuby/trunk/load.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 29 17:32:32 PST 2010


Revision: 3373
          http://trac.macosforge.org/projects/ruby/changeset/3373
Author:   lsansonetti at apple.com
Date:     2010-01-29 17:32:31 -0800 (Fri, 29 Jan 2010)
Log Message:
-----------
make sure to catch Exception-based exceptions when requiring a file

Modified Paths:
--------------
    MacRuby/trunk/load.c

Modified: MacRuby/trunk/load.c
===================================================================
--- MacRuby/trunk/load.c	2010-01-30 01:31:55 UTC (rev 3372)
+++ MacRuby/trunk/load.c	2010-01-30 01:32:31 UTC (rev 3373)
@@ -87,6 +87,7 @@
 
     // Load it.
     const char *fname_str = RSTRING_PTR(fname);
+//printf("load %s\n", fname_str);
     NODE *node = (NODE *)rb_load_file(fname_str);
     if (node == NULL) {
 	rb_raise(rb_eSyntaxError, "compile error");
@@ -251,10 +252,10 @@
 }
 
 static VALUE
-load_rescue(VALUE path)
+load_rescue(VALUE path, VALUE exc)
 {
     rb_remove_feature(path);
-    rb_exc_raise(rb_vm_current_exception());
+    rb_exc_raise(exc);
     return Qnil;
 }
 
@@ -282,7 +283,8 @@
 	    rb_provide_feature(path);
 	    switch (type) {
 		case TYPE_RB:
-		    rb_rescue(load_try, path, load_rescue, path);
+		    rb_rescue2(load_try, path, load_rescue, path,
+			    rb_eException, 0);
 		    break;
 
 		case TYPE_RBO:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100129/e6afaf88/attachment.html>


More information about the macruby-changes mailing list