File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 */
1212#define RUBYJSONNET_GLOBAL_ESCAPE_MAGIC "\x07\x03\x0c:rubytag:\x07\x03\x0c:"
1313
14+ /* Copied from vm_core.h in Ruby. State variables in global escapes have
15+ * this value when an exception is raised.
16+ *
17+ * TODO(yugui) Find a better way to distinguish "raise" from "throw".
18+ * It is not a very good idea to depend on the implementation details of Ruby.
19+ */
20+ #define RUBY_TAG_RAISE 0x6
21+
1422/*
1523 * callback support in VM
1624 */
@@ -44,9 +52,9 @@ invoke_callback(VALUE args)
4452static VALUE
4553rescue_callback (int state , const char * fmt , ...)
4654{
47- VALUE err = rb_errinfo ();
48- if ( rb_obj_is_kind_of ( err , rb_eException )) {
49- VALUE msg = rb_protect (rubyjsonnet_format_exception , rb_errinfo () , NULL );
55+ if ( state == RUBY_TAG_RAISE ) {
56+ VALUE err = rb_errinfo ();
57+ VALUE msg = rb_protect (rubyjsonnet_format_exception , err , NULL );
5058 if (msg == Qnil ) {
5159 va_list ap ;
5260 va_start (ap , fmt );
Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ class TestVM < Test::Unit::TestCase
5454 end
5555 end
5656
57-
5857 test 'Jsonnet::VM#evaluate evaluates snippet' do
5958 vm = Jsonnet ::VM . new
6059 result = vm . evaluate ( <<-EOS , filename : 'example.snippet' )
You can’t perform that action at this time.
0 commit comments