diff options
Diffstat (limited to 'eval_error.c')
-rw-r--r-- | eval_error.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/eval_error.c b/eval_error.c index b21394914d..5d203d69a8 100644 --- a/eval_error.c +++ b/eval_error.c @@ -87,6 +87,7 @@ error_print(void) volatile VALUE eclass = Qundef, e = Qundef; const char *volatile einfo; volatile long elen; + VALUE mesg; if (NIL_P(errinfo)) return; @@ -105,28 +106,13 @@ error_print(void) else { goto no_message; } - if (NIL_P(errat)) { - int line; - const char *file = rb_source_loc(&line); - if (!file) - warn_printf("%d: ", line); - else if (!line) - warn_printf("%s: ", file); - else - warn_printf("%s:%d: ", file, line); - } - else if (RARRAY_LEN(errat) == 0) { + if (NIL_P(errat) || RARRAY_LEN(errat) == 0 || + NIL_P(mesg = RARRAY_AREF(errat, 0))) { error_pos(); } else { - VALUE mesg = RARRAY_AREF(errat, 0); - - if (NIL_P(mesg)) - error_pos(); - else { - warn_print_str(mesg); - warn_print(": "); - } + warn_print_str(mesg); + warn_print(": "); } eclass = CLASS_OF(errinfo); |