summaryrefslogtreecommitdiffhomepage
path: root/src/print.c
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2019-12-17 23:16:20 +0900
committerKOBAYASHI Shuji <[email protected]>2019-12-17 23:16:20 +0900
commit29ecc3840a6df57deba9b22d917aee37f66ffc4f (patch)
tree751036caa78c352800bc25ec42cc2baf65c31ffb /src/print.c
parent8bc9a79e65bb4ee9f1791daf2726d33ac43d727d (diff)
downloadmruby-29ecc3840a6df57deba9b22d917aee37f66ffc4f.tar.gz
mruby-29ecc3840a6df57deba9b22d917aee37f66ffc4f.zip
Refine output of `mrb_print_error()`
The following improvements are made according to Ruby's behavior: - Match location number to index. - Remove duplicate most recent call output. - Fix that first call is not output when array (unpacked) backtrace. ### Example ```ruby def a; raise "error!" end def b; a end begin b rescue => e e.backtrace if ARGV[0] == "unpack" # unpack backtrace raise e end ``` #### Before this patch: ``` $ bin/mruby example.rb unpack trace (most recent call last): [0] example.rb:2:in b [1] example.rb:1:in a example.rb:1: error! (RuntimeError) ``` #### After this patch: ``` $ bin/mruby example.rb unpack trace (most recent call last): [2] example.rb:4 [1] example.rb:2:in b example.rb:1:in a: error! (RuntimeError) ```
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/print.c b/src/print.c
index 03b5eadfa..7d2d16086 100644
--- a/src/print.c
+++ b/src/print.c
@@ -31,7 +31,6 @@ MRB_API void
mrb_print_error(mrb_state *mrb)
{
mrb_print_backtrace(mrb);
- printstr(mrb_funcall(mrb, mrb_obj_value(mrb->exc), "inspect", 0), stderr);
}
MRB_API void