diff --git a/ChangeLog b/ChangeLog index 109288073b..300ebae32a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Mar 4 22:49:42 2010 Yusuke Endoh + + * eval.c (setup_exception): avoid line number 0 when setting + $DEBUG=true. [ruby-dev:39116] + Thu Mar 4 22:45:02 2010 Yusuke Endoh * io.c (io_s_write, io_s_binwrite): add File#write and #binwrite. diff --git a/eval.c b/eval.c index 6deed9cd30..a1deab6c8b 100644 --- a/eval.c +++ b/eval.c @@ -394,11 +394,16 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg) PUSH_TAG(); if ((status = EXEC_TAG()) == 0) { RB_GC_GUARD(e) = rb_obj_as_string(e); - if (file) { + if (file && line) { warn_printf("Exception `%s' at %s:%d - %s\n", rb_obj_classname(th->errinfo), file, line, RSTRING_PTR(e)); } + else if (file) { + warn_printf("Exception `%s' at %s - %s\n", + rb_obj_classname(th->errinfo), + file, RSTRING_PTR(e)); + } else { warn_printf("Exception `%s' - %s\n", rb_obj_classname(th->errinfo),