summaryrefslogtreecommitdiff
path: root/eval_error.c
AgeCommit message (Collapse)Author
2024-02-15Do not include a backtick in error messages and backtracesYusuke Endoh
[Feature #16495]
2024-01-02Fix Exception#detailed_message for GC compactionPeter Zhu
Before this commit, the test fails with RGENGC_CHECK_MODE enabled: TestException#test_detailed_message_under_gc_compact_stress [test/ruby/test_exception.rb:1466]: <"\e[1mfoo (\e[1;4mRuntimeError\e[m\e[1m)\e[m\n" + "\e[1mbar\e[m\n" + "\e[1mbaz\e[m"> expected but was <"\e[1mfoo (\e[1;4mRuntimeError\e[m\e[1m)\e[m\n" + "\e[1m\x00\x00\x00\x00\x00\x00\x00\e[m">.
2023-07-19[Bug #19774] Fix segfault at `return` in `END`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8093
2023-04-10Prefer `write_warn` over `write_warn2` with a string literalNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7681
2023-04-10[Bug #19570] Propagate message encoding to decorated messageNobuyoshi Nakada
2022-12-20[Bug #19242] Prohibit circular causes to be loadedNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6960
2022-11-25[Bug #19145] `volatile` on an argument may not be effectiveNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6807
2022-11-22[Bug #19016] re-order error handling at cleanupNobuyoshi Nakada
Build and store the error message with `#detailed_message` before terminating all Ractors, then show the message later. Notes: Merged: https://github.com/ruby/ruby/pull/6778
2022-11-20Use `enum ruby_tag_type` over `int`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6771
2022-11-16Using UNDEF_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6721
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-02-22Remove unneeded newline from detailed_messageYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/5516
2022-02-22Exception#detailed_message is addedYusuke Endoh
Also, the default error printer and Exception#full_message use the method instead of `Exception#message` to get the message string. `Exception#detailed_message` calls `Exception#message`, decorates and returns the result. It adds some escape sequences to highlight, and the class name of the exception to the end of the first line of the message. [Feature #18370] Notes: Merged: https://github.com/ruby/ruby/pull/5516
2022-02-22Refactor out rb_decorate_message from print_errinfoYusuke Endoh
rb_decorate_message adds bold escape sequences to message, and the class name of exception (like " (RuntimeError)) of "message (RuntimeError)"). Notes: Merged: https://github.com/ruby/ruby/pull/5516
2022-02-22Do not escape error messageYusuke Endoh
[Feature #18367] Notes: Merged: https://github.com/ruby/ruby/pull/5516
2022-02-22error.c: RefactoringYusuke Endoh
Factor out from rb_error_write the responsibility to check if stderr is a tty. Notes: Merged: https://github.com/ruby/ruby/pull/5516
2021-09-01Trim extra whitespace in inaccesible error messageOKURA Masafumi
One whitespace is already included in `inaccessible_mesg_for` macro. This extra whitespace is included since 72ff61f4a8ae7a8bf05b0bd6f91b3b290645627c Notes: Merged: https://github.com/ruby/ruby/pull/4447
2020-12-27Limit bactrace length from Exception#full_messageNobuyoshi Nakada
2020-12-21eval_error.c: fix off-by-one error for --backtrace-limitYusuke Endoh
https://bugs.ruby-lang.org/issues/17413
2020-07-15Fixed infinite loop at error in printing cause [Bug #17033]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3320
2020-05-15Merge pull request #3047 from mame/suppress-backtraceYusuke Endoh
Add `--suppress-backtrace=num` option to limit the backtrace length Notes: Merged-By: mame <mame@ruby-lang.org>
2020-04-21eval_error.c: default nil as "reverse" is now false [Feature #8661]Nobuyoshi Nakada
2020-04-21eval_error.c: revert the "reversed" backtrace [Feature #8661]Yusuke Endoh
Now, the order is good, old-fashioned style: ``` $ ./local/bin/ruby -e 'def foo; raise; end def bar; foo; end def baz; bar; end def qux; baz; end qux ' -e:1:in `foo': unhandled exception from -e:2:in `bar' from -e:3:in `baz' from -e:4:in `qux' from -e:5:in `<main>' ```
2020-04-15Raise EPIPE at broken pipe for the backward compatibilityNobuyoshi Nakada
Instead of SignalException for SIGPIPE, raise `Errno::EPIPE` with instance variable `signo` and re-send that signal at exit. [Feature #14413] Notes: Merged: https://github.com/ruby/ruby/pull/3035
2019-08-13Renamed ruby_finalize_{0,1}Nobuyoshi Nakada
And pass rb_execution_context_t as an argument.
2019-07-15Removed duplicate highlightingNobuyoshi Nakada
2019-07-15* expand tabs.git
2019-07-15Removed dead codeNobuyoshi Nakada
If `emesg` is `Qundef`, it is not a message string and then `elen` (the length of the message) is 0. So `emesg` cannot be `Qundef` in the `elen != 0` block. Pointed out by Coverity Scan.
2019-01-24eval_error.c: should not escapce newline and tabnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-08* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-08Defer escaping control char in error messagesnobu
* eval_error.c (print_errinfo): defer escaping control char in error messages until writing to stderr, instead of quoting at building the message. [ruby-core:90853] [Bug #15497] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-22Fix for circular causesnobu
* eval_error.c (show_cause): get rid of infinite recursion on circular causes. [Bug #15447] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-21eval_error.c (show_cause): check if cause is an Exception or notmame
Fixes [Bug #15447] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-15eval_error.c: log10(0) is ERANGEshyouhei
By definition, the logarithm of 0 is negative infinity. This is a pole error (cf: cf: ISO/IEC 9899:1999 section 7.12.1 paragraph 3) and of course, cannot fit into an `int` value. We have to resort to INT_MIN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-27fix error message and backtrace ordernaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-27Print exception's cause like Javanaruse
Print `cause` of the exception if the exception is not caught and printed its backtraces and error message [Feature #8257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-19rb_execution_context_t: pack bits, 256 -> 252 bytes (on 32-bit)normal
Maybe execution contexts will become more common. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-13Prefer `rb_fstring_lit` over `rb_fstring_cstr`nobu
The former states explicitly that the argument must be a literal, and can optimize away `strlen` on all compilers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-11eval_error.c: fix loop on exception in messagenobu
* error.c (rb_get_message): accessor to the message. * eval_error.c (rb_ec_error_print): handle exceptions on fetching the message. [Bug #14566] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13eval_error.c: reset attributesnobu
* eval_error.c (print_errinfo): reset all attributes for each lines before newlines. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13eval_error.c: last newlinenobu
* eval_error.c (print_errinfo): do not print an empty line at the end when the message ends with a newline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-12eval_error.c: fix underflownobu
* eval_error.c (print_errinfo): get rid of negative string length. [ruby-core:86086] [Bug #14598] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-23eval_error.c: rb_error_write flagsnobu
* eval_error.c (rb_error_write): add highlight and reverse mode flags. defaulted to rb_stderr_tty_p() if Qnil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07eval_error.c: reset in each linenobu
* eval_error.c (print_errinfo): reset in each line, so that Exception#full_message ends with a newline and puts will not print an extra newline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07eval_error.c: concat directlynobu
* eval_error.c (write_warn, write_warn2): get rid of unnecessary intermediate string objects, concat directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07eval_error.c: renamed an argumentnobu
* eval_error.c (print_errinfo): renamed argument `colored` as `highlight`, as it does not use colors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02fix uninitialized variableshyouhei
Likewise this can easily be noticed if you read the warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-18eval_error.c: Fix compile error on Solaris 10ngoto
* eval_error.c (write_warn, write_warn2, write_warn_str): Fix compile error "operands have incompatible types" with Oracle Solaris Studio 12.4 on Solaris 10. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12error.c(rb_error_write): Remove ec_ from its namesorah
It's unrelated to rb_execution_context_t during writing the patch r61154 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12hotfix implicit-function-declarationsorah
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e