Skip to content

Commit

Permalink
check message of exception
Browse files Browse the repository at this point in the history
Test Script:
----
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

class ZeroDivisionError
  def self.new(message)
    42
  end
end

assert_raise(TypeError){ 1/0 }
  • Loading branch information
Watson1978 committed Jan 26, 2012
1 parent 4144e6a commit 8bcbdc3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,19 @@ VALUE rb_make_backtrace(void);
void
rb_exc_raise(VALUE mesg)
{
if (!NIL_P(mesg)) {
mesg = rb_make_exception(1, &mesg);
}
rb_vm_raise(mesg);
abort();
}

void
rb_exc_fatal(VALUE mesg)
{
if (!NIL_P(mesg)) {
mesg = rb_make_exception(1, &mesg);
}
rb_vm_raise(mesg);
abort();
}
Expand Down

0 comments on commit 8bcbdc3

Please sign in to comment.