mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix 36fc1f14 not checking in the right location
This commit is contained in:
committed by
Clayton Smith
parent
db1bd078be
commit
6be5160eb6
+3
-2
@@ -280,8 +280,6 @@ mrb_exc_set(mrb_state *mrb, mrb_value exc)
|
||||
mrb->exc = 0;
|
||||
}
|
||||
else {
|
||||
if (!mrb_obj_is_kind_of(mrb, exc, mrb->eException_class))
|
||||
mrb_raise(mrb, E_TYPE_ERROR, "exception object expected");
|
||||
mrb->exc = mrb_obj_ptr(exc);
|
||||
}
|
||||
}
|
||||
@@ -289,6 +287,9 @@ mrb_exc_set(mrb_state *mrb, mrb_value exc)
|
||||
MRB_API mrb_noreturn void
|
||||
mrb_exc_raise(mrb_state *mrb, mrb_value exc)
|
||||
{
|
||||
if (!mrb_obj_is_kind_of(mrb, exc, mrb->eException_class)) {
|
||||
mrb_raise(mrb, E_TYPE_ERROR, "exception object expected");
|
||||
}
|
||||
mrb_exc_set(mrb, exc);
|
||||
if (!mrb->gc.out_of_memory) {
|
||||
exc_debug_info(mrb, mrb->exc);
|
||||
|
||||
@@ -51,3 +51,21 @@ assert('Can still call super when BasicObject#method_missing is removed') do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert("NoMethodError#new does not return an exception") do
|
||||
begin
|
||||
class << NoMethodError
|
||||
def new(*)
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
assert_raise(TypeError) do
|
||||
Object.q
|
||||
end
|
||||
ensure
|
||||
class << NoMethodError
|
||||
remove_method :new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user