lib/nydp/builtin.rb in nydp-0.2.3 vs lib/nydp/builtin.rb in nydp-0.2.5
- old
+ new
@@ -8,44 +8,46 @@
def builtin_invoke_3 vm, a0, a1 ; builtin_invoke vm, cons(a0, cons(a1)) ; end
def builtin_invoke_4 vm, a0, a1, a2 ; builtin_invoke vm, cons(a0, cons(a1, cons(a2))) ; end
def invoke_1 vm
builtin_invoke_1 vm
- rescue Exception => e
- handle_error e, Nydp::NIL
+ rescue StandardError => e
+ handle_error e
end
def invoke_2 vm, arg
builtin_invoke_2 vm, arg
- rescue Exception => e
- handle_error e, cons(arg)
+ rescue StandardError => e
+ handle_error e, arg
end
def invoke_3 vm, arg_0, arg_1
builtin_invoke_3 vm, arg_0, arg_1
- rescue Exception => e
- handle_error e, cons(arg_0, cons(arg_1))
+ rescue StandardError => e
+ handle_error e, arg_0, arg_1
end
def invoke_4 vm, arg_0, arg_1, arg_2
builtin_invoke_4 vm, arg_0, arg_1, arg_2
- rescue Exception => e
- handle_error e, cons(arg_0, cons(arg_1, cons(arg_2)))
+ rescue StandardError => e
+ handle_error e, arg_0, arg_1, arg_2
end
def invoke vm, args
builtin_invoke vm, args
- rescue Exception => e
- handle_error e, args
+ rescue StandardError => e
+ handle_error e, *(args.to_a)
end
- def handle_error e, args
+
+ def handle_error e, *args
case e
when Nydp::Error
raise e
else
- new_msg = "Called #{self.inspect}\nwith args #{args.inspect}\nraised\n#{Nydp.indent_text e.message}\nat #{e.backtrace.first}"
- raise $!, new_msg, $!.backtrace
+ arg_msg = args.map { |a| " #{a.inspect}"}.join("\n")
+ new_msg = "Called #{self.inspect}\nwith args\n#{arg_msg}"
+ raise new_msg
end
end
def name
cname = self.class.name.split("::").last