summaryrefslogtreecommitdiff
path: root/error.c
AgeCommit message (Collapse)Author
2023-05-12[Bug #19635] Preserve `errno`Nobuyoshi Nakada
The following functions are turned into macros and no longer can be used as expressions in core. - rb_sys_fail - rb_sys_fail_str - rb_sys_fail_path
2023-04-14Add RB_WARN_CATEGORY_DEFAULT_BITSJean Boussier
Followup: ac123f167a364c3d7a43eca78d564e41f6dbb91e RB_WARN_CATEGORY_ALL_BITS is exposed in a public header, so it makes sense for it to be updated to contain all valid bits. Instead we introduce RB_WARN_CATEGORY_DEFAULT_BITS to list the categories that are enabled by default. Notes: Merged: https://github.com/ruby/ruby/pull/7710
2023-04-13Emit a performance warning when a class reached max variationsJean Boussier
[Feature #19538] This new `peformance` warning category is disabled by default. It needs to be specifically enabled via `-W:performance` or `Warning[:performance] = true` Notes: Merged: https://github.com/ruby/ruby/pull/7708
2023-04-13Disable all warning categories other than `RB_WARN_CATEGORY_ALL_BITS`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7706
2023-03-06Stop exporting symbols for MJITTakashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7459
2023-02-20Adjust indent [ci skip]Nobuyoshi Nakada
2023-02-20error.c: Use "undefined local variable or method `...' for main"Yusuke Endoh
... for the toplevel. Notes: Merged: https://github.com/ruby/ruby/pull/6950
2023-02-20error.c: Update the message format for NoMethodErrorYusuke Endoh
* If the receiver is a Class, use "... for class <class name>". * If the receiver is a Module, use "... for module <module name>". * If the receiver is an extended object (i.e., has a singleton class), use "... for <rb_any_to_s(receiver)>". * Otherwise, use "... for an instance of <class name>". Examples: ``` 42.time #=> undefined method `time' for an instance of Integer (NoMethodError) class Foo privatee #=> undefined local variable or method 'privatee' for class Foo (NoMethodError) end def (o=Object.new).foo end o.bar #=> undefined method `bar' for #<Object: 0xdeadbeef(any_to_s)> (NoMethodError) ``` Notes: Merged: https://github.com/ruby/ruby/pull/6950
2023-02-20Stop using receiver#inspect for "undefined method" errorsYusuke Endoh
``` 42.time #=> undefined method `time' for object Integer (NoMethodError) class Foo privatee #=> undefined local variable or method 'privatee' for class Foo (NoMethodError) end s = "" def s.foo = nil s.bar #=> undefined method `bar' for extended object String (NoMethodError) ``` [Feature #18285] Notes: Merged: https://github.com/ruby/ruby/pull/6950
2022-12-23Docs: Fix rendering of SyntaxError#pathzverok
Notes: Merged: https://github.com/ruby/ruby/pull/6985
2022-12-20[Bug #19242] Prohibit circular causes to be loadedNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6960
2022-12-08Introduce `IO.new(..., path:)` and promote `File#path` to `IO#path`. (#6867)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-12-02Reuse NIL_OR_UNDEF_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6787
2022-12-01[Feature #19138] Add `SyntaxError#path`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6779
2022-11-16Using UNDEF_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6721
2022-10-19Fix and improve coroutines for Darwin (macOS) ppc/ppc64. (#5975)Sergey Fedorov
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-17Fix possible use of undefined macros on very old macOS [ci skip]Nobuyoshi Nakada
2022-10-10Reuse `with_warning_string_from` macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/6471 Merged-By: nobu <nobu@ruby-lang.org>
2022-09-30Split `with_warning_string_from` for the last named parameterNobuyoshi Nakada
2022-09-23Revert "Revert "error.c: Let Exception#inspect inspect its message""Yusuke Endoh
This reverts commit b9f030954a8a1572032f3548b39c5b8ac35792ce. [Bug #18170]
2022-09-21syserr_initialize: delete redundant strerror() declaration卜部昌平
This line issues a warning on clang. strerror is of course a part of ISO C since its dawn. We practically have never needed it. Notes: Merged: https://github.com/ruby/ruby/pull/6358
2022-08-12Introduce with_warn_vsprintf macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6225
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-07-13Fix a typo (thanks @Maumagnaguagno !)Yusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/6119
2022-07-13Specify usable escape sequences in Exception#detailed_messageYusuke Endoh
An error message is primarily rendered in a terminal emulator, but is also shown in a browser by converting it to a HTML fragment. However, the conversion would be unreasonably difficult if the message includes any escape sequence (such as cursor move or screen clear). This change adds a guideline about escape sequences in `Exception#detailed_message`: * Use widely-supported escape sequences: bold, underline, and basic eight foreground colors (except white and black). * Make the message readable if all escape sequences are ignored. Notes: Merged: https://github.com/ruby/ruby/pull/6119
2022-06-20Include JIT information in crash reportsChris Seaton
Since enabling YJIT or MJIT drastically changes what could go wrong at runtime, it's good to be front and center about whether they are enabled when dumping a crash report. Previously, `RUBY_DESCRIPTION` and the description printed when crashing can be different when a JIT is on. Introduce a new internal data global, `rb_dynamic_description`, and set it to be the same as `RUBY_DESCRIPTION` during initialization; use it when crashing. * version.c: Init_ruby_description(): Initialize and use `rb_dynamic_description`. * error.c: Change crash reports to use `rb_dynamic_description`. * ruby.c: Call `Init_ruby_description()` earlier. Slightly more work for when we exit right after printing the description but that was deemed acceptable. * include/ruby/version.h: Talk about how JIT info is not in `ruby_description`. * test/-ext-/bug_reporter/test_bug_reporter.rb: Remove handling for crash description being different from `RUBY_DESCRIPTION`. * test/ruby/test_rubyoptions.rb: ditto Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Alan Wu <alanwu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/5872
2022-06-20Allow to just warn as bool expected, without an exceptionNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6039
2022-06-08[DOC] RDoc now accepts other than magic numbers at `rb_attr`Nobuyoshi Nakada
2022-06-07Revert "error.c: Let Exception#inspect inspect its message"Yusuke Endoh
This reverts commit 9d927204e7b86eb00bfd07a060a6383139edf741. Notes: Merged: https://github.com/ruby/ruby/pull/5981
2022-06-07error.c: Let Exception#inspect inspect its messageYusuke Endoh
... only when the message string has a newline. `p StandardError.new("foo\nbar")` now prints `#<StandardError: "foo\nbar">' instead of: #<StandardError: bar> [Bug #18170] Notes: Merged: https://github.com/ruby/ruby/pull/4857
2022-06-05Use RBOOLNobuyoshi Nakada
2022-05-21No fallback to default valuesNobuyoshi Nakada
2022-02-22Factor a "highlight" symbol outYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/5516
2022-02-22Let Exception#full_message pass highlight keywords to #detailed_messageYusuke Endoh
.. even when the argument is not explicitly passed. Notes: Merged: https://github.com/ruby/ruby/pull/5516
2022-02-22The default highlight arguments of Exception#detailed_message is falseYusuke 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-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
2022-01-04Don't segfault if Warning.warn is undefinedJeremy Evans
Check that there is a method entry for the method before passing it to rb_method_entry_arity. Fixes [Bug #18458] Notes: Merged: https://github.com/ruby/ruby/pull/5391
2021-12-26Remove tainted and trusted featuresNobuyoshi Nakada
Already these had been announced to be removed in 3.2. Notes: Merged: https://github.com/ruby/ruby/pull/5348
2021-11-09Some codes replace to `RBOOL` macro (#5023)S.H
* Some code replace and using RBOOL macro * Fix indent * Using RBOOL in syserr_eqq function Notes: Merged-By: nobu <nobu@ruby-lang.org>
2021-10-30Add `rb_mod_exc_raise` function and replace duplicate codeS.H
Notes: Merged: https://github.com/ruby/ruby/pull/5063 Merged-By: nobu <nobu@ruby-lang.org>
2021-10-03Using NIL_P macro instead of `== Qnil`S.H
Notes: Merged: https://github.com/ruby/ruby/pull/4925 Merged-By: nobu <nobu@ruby-lang.org>
2021-09-15Refactor and Using RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4837 Merged-By: nobu <nobu@ruby-lang.org>
2021-09-10suppress GCC's -Wsuggest-attribute=format卜部昌平
I was not aware of this because I use clang these days. Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-10include/ruby/internal/error.h: add doxygen卜部昌平
Must not be a bad idea to improve documents. Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-08-15Show verbose error messages when single pattern match failsKazuki Tsujimoto
[0] => [0, *, a] #=> [0] length mismatch (given 1, expected 2+) (NoMatchingPatternError) Ignore test failures of typeprof caused by this change for now.
2021-08-14Get rid of unintented recursion when RUBY_DEBUGNobuyoshi Nakada
2021-08-14Mark internal class namesNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4741
2021-08-14Add some "cold" marksNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4741
2021-08-14A comment for typed data in `rb_check_type` [ci skip]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4741