Projects

Ticket #428 (closed defect: fixed)

Opened 2 years ago

Last modified 14 months ago

AOT compiled script can't get rescued

Reported by: mattaimonetti@… Owned by: lsansonetti@…
Priority: major Milestone: MacRuby 0.8
Component: MacRuby Keywords:
Cc:

Description (last modified by mattaimonetti@…) (diff)

t.rb

begin
  require 't1'
rescue Exception => e
  puts "oops let's continue even tho: #{e.message}"
end

puts 'done'

t1.rb

class Foo < DoesNotExist
end
$ macruby t.rb
oops let's continue even tho: uninitialized constant DoesNotExist
done

Then compile t1.rb

$ macrubyc -C t1.rb

now try again:

$ macruby t.rb
2009-11-09 14:26:04.441 macruby[6041:903] *** Terminating app due to uncaught exception 'NameError', reason: 'uninitialized constant DoesNotExist'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x00007fff8454f5a4 __exceptionPreprocess + 180
	1   libobjc.A.dylib                     0x00007fff804e1313 objc_exception_throw + 45
	2   libmacruby.dylib                    0x0000000100179405 rb_vm_raise + 437
	3   libmacruby.dylib                    0x00000001000400d9 rb_exc_raise + 9
	4   libmacruby.dylib                    0x000000010003cbb4 rb_name_error + 260
	5   libmacruby.dylib                    0x000000010010a0d3 rb_mod_const_missing + 83
	6   libmacruby.dylib                    0x000000010015da9c rb_vm_call_with_cache2 + 4652
	7   libmacruby.dylib                    0x000000010011f749 rb_funcall + 425
	8   libmacruby.dylib                    0x0000000100109c86 rb_const_get_0 + 758
	9   libmacruby.dylib                    0x000000010017bc72 _ZL18rb_vm_const_lookupmmbb + 162
	10  libmacruby.dylib                    0x000000010017f255 rb_vm_get_const + 613
	11  t1.rbo                              0x000000010119adda MREP_E8A8218CC60A4CC58372196710D15355 + 122
	12  t1.rbo                              0x000000010119ad51 _GLOBAL__I_main.c + 9
	13  ???                                 0x00007fff5fc0d500 0x0 + 140734799860992
	14  ???                                 0x00007fff5fc0bcec 0x0 + 140734799854828
	15  ???                                 0x00007fff5fc0bda6 0x0 + 140734799855014
	16  ???                                 0x00007fff5fc08fbb 0x0 + 140734799843259
	17  libSystem.B.dylib                   0x00007fff84783d40 dlopen + 61
	18  libmacruby.dylib                    0x0000000100114c12 dln_load + 322
	19  libmacruby.dylib                    0x00000001000488f2 rb_require_safe + 466
	20  libmacruby.dylib                    0x000000010016c030 rb_vm_dispatch + 7648
	21  ???                                 0x0000000101100065 0x0 + 4312793189
	22  libmacruby.dylib                    0x00000001000402f9 ruby_run_node + 73
	23  macruby                             0x0000000100000dd8 main + 152
	24  macruby                             0x0000000100000d34 start + 52
)
terminate called after throwing an instance of 'NSException'
Abort trap

Attachments

t.rb Download (111 bytes) - added by mattaimonetti@… 2 years ago.
t1.rb Download (28 bytes) - added by mattaimonetti@… 2 years ago.
428.rb Download (122 bytes) - added by emil@… 14 months ago.
working example - file 1/2
428required.rb Download (31 bytes) - added by emil@… 14 months ago.
working example - file 2/2

Change History

Changed 2 years ago by mattaimonetti@…

  • attachment t.rb Download added

Changed 2 years ago by mattaimonetti@…

Changed 2 years ago by mattaimonetti@…

  • description modified (diff)

Changed 14 months ago by emil@…

working example - file 1/2

Changed 14 months ago by emil@…

working example - file 2/2

Changed 14 months ago by emil@…

can't reproduce this in trunk rev 4976. includes is a working example that consists of two files. if you compile 428required.rb using:

macrubyc -C 428required.rb

you can remove the 428required.rb file and run 428.rb, and it will load the 428requied.rbo and pass the exception to the 428.rb main file.

Changed 14 months ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from MacRuby 0.5 to MacRuby 0.8

Thanks for checking it. Indeed, it should be fixed now.

Note: See TracTickets for help on using tickets.