diff --git a/assets/tests/ruby/promise_runtime_error.rb b/assets/tests/ruby/promise_runtime_error.rb index a3bdc78..09f5aa7 100644 --- a/assets/tests/ruby/promise_runtime_error.rb +++ b/assets/tests/ruby/promise_runtime_error.rb @@ -1,5 +1,5 @@ def test_func rust_func.and_then lambda { |x| - $state['x'] = x + print('abc' + 5) } end diff --git a/src/runtimes/ruby.rs b/src/runtimes/ruby.rs index 3d05da3..c27933a 100644 --- a/src/runtimes/ruby.rs +++ b/src/runtimes/ruby.rs @@ -368,7 +368,9 @@ impl Runtime for RubyRuntime { .into_iter() .map(|x| ruby.get_inner(x.0).as_value()) .collect(); - let result: magnus::Value = f.funcall("call", args.as_slice()).unwrap(); + let result: magnus::Value = f.funcall("call", args.as_slice()).map_err(|e| { + ScriptingError::RuntimeError(Box::new(io::Error::other(e.to_string()))) + })?; Ok(RubyValue::new(result)) })) }