summaryrefslogtreecommitdiff
path: root/error.c
Commit message (Collapse)AuthorAgeFilesLines
* Introduce with_warn_vsprintf macroS-H-GAMELINKS2022-08-121-27/+22
|
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-341/+341
| | | | [Misc #18891]
* Fix a typo (thanks @Maumagnaguagno !)Yusuke Endoh2022-07-131-1/+1
|
* Specify usable escape sequences in Exception#detailed_messageYusuke Endoh2022-07-131-0/+22
| | | | | | | | | | | | | | 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.
* Include JIT information in crash reportsChris Seaton2022-06-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Allow to just warn as bool expected, without an exceptionNobuyoshi Nakada2022-06-201-1/+1
|
* [DOC] RDoc now accepts other than magic numbers at `rb_attr`Nobuyoshi Nakada2022-06-081-1/+1
|
* Revert "error.c: Let Exception#inspect inspect its message"Yusuke Endoh2022-06-071-10/+2
| | | | This reverts commit 9d927204e7b86eb00bfd07a060a6383139edf741.
* error.c: Let Exception#inspect inspect its messageYusuke Endoh2022-06-071-2/+10
| | | | | | | | | | | | ... only when the message string has a newline. `p StandardError.new("foo\nbar")` now prints `#<StandardError: "foo\nbar">' instead of: #<StandardError: bar> [Bug #18170]
* Use RBOOLNobuyoshi Nakada2022-06-051-6/+1
|
* No fallback to default valuesNobuyoshi Nakada2022-05-211-3/+2
|
* Factor a "highlight" symbol outYusuke Endoh2022-02-221-7/+4
|
* Let Exception#full_message pass highlight keywords to #detailed_messageYusuke Endoh2022-02-221-0/+7
| | | | .. even when the argument is not explicitly passed.
* The default highlight arguments of Exception#detailed_message is falseYusuke Endoh2022-02-221-5/+10
|
* Exception#detailed_message is addedYusuke Endoh2022-02-221-4/+53
| | | | | | | | | | | 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]
* error.c: RefactoringYusuke Endoh2022-02-221-32/+60
| | | | | Factor out from rb_error_write the responsibility to check if stderr is a tty.
* Don't segfault if Warning.warn is undefinedJeremy Evans2022-01-041-1/+2
| | | | | | | Check that there is a method entry for the method before passing it to rb_method_entry_arity. Fixes [Bug #18458]
* Remove tainted and trusted featuresNobuyoshi Nakada2021-12-261-13/+0
| | | | Already these had been announced to be removed in 3.2.
* Some codes replace to `RBOOL` macro (#5023)S.H2021-11-091-3/+1
| | | | | | | * Some code replace and using RBOOL macro * Fix indent * Using RBOOL in syserr_eqq function
* Add `rb_mod_exc_raise` function and replace duplicate codeS.H2021-10-301-8/+13
|
* Using NIL_P macro instead of `== Qnil`S.H2021-10-031-1/+1
|
* Refactor and Using RBOOL macroS.H2021-09-151-7/+2
|
* suppress GCC's -Wsuggest-attribute=format卜部昌平2021-09-101-0/+5
| | | | I was not aware of this because I use clang these days.
* include/ruby/internal/error.h: add doxygen卜部昌平2021-09-101-1/+1
| | | | Must not be a bad idea to improve documents.
* Show verbose error messages when single pattern match failsKazuki Tsujimoto2021-08-151-1/+74
| | | | | | | [0] => [0, *, a] #=> [0] length mismatch (given 1, expected 2+) (NoMatchingPatternError) Ignore test failures of typeprof caused by this change for now.
* Get rid of unintented recursion when RUBY_DEBUGNobuyoshi Nakada2021-08-141-1/+1
|
* Mark internal class namesNobuyoshi Nakada2021-08-141-3/+3
|
* Add some "cold" marksNobuyoshi Nakada2021-08-141-3/+3
|
* A comment for typed data in `rb_check_type` [ci skip]Nobuyoshi Nakada2021-08-141-0/+8
|
* Using RBOOL macroS.H2021-08-021-5/+3
|
* Use UNREACHABLE instead of fall throughKazuhiro NISHIYAMA2021-07-201-1/+1
|
* Add `fall through`Kazuhiro NISHIYAMA2021-07-191-0/+1
| | | | | | | | | Pointed out by Coverity Scan ``` ** CID 1487522: Control flow issues (MISSING_BREAK) /error.c: 1273 in exc_full_message() ```
* Make boolean expected messages more consitentNobuyoshi Nakada2021-07-181-2/+1
|
* Specify version to remove as bare numbersNobuyoshi Nakada2021-06-301-2/+2
|
* Show the removal versionNobuyoshi Nakada2021-06-301-5/+7
|
* rb_warn_deprecated_to_remove_at [Feature #17432]Nobuyoshi Nakada2021-06-301-16/+31
| | | | | At compilation time with RUBY_DEBUG enabled, check if the removal version has been reached.
* Fix example for custom warn methodAdam Daniels2021-04-301-1/+1
| | | | | | Regexp has a match? method. [ci skip]
* Remove unneeded rb_ident_hash_new function declarationS-H-GAMELINKS2021-03-281-1/+0
|
* Fix segmentation fault when `Module#name` returns non string value [Bug #17754]Kenichi Kamiya2021-03-281-1/+3
| | | | | * Add test for NoMethodError#to_s does not segfault * Ensure no segfault even if Module#name is overridden
* Fix grammatical errorGaren Torikian2021-02-061-1/+1
|
* Implement NameError::message#clone for RactorNobuyoshi Nakada2021-02-011-2/+33
|
* Fixed varargs in `rb_bug_without_die` [Bug #17603]xtkoba (Tee KOBAYASHI)2021-02-011-2/+2
|
* Bypass check for warning_category on internal callsNobuyoshi Nakada2020-12-281-26/+37
|
* Make NoMatchingPatternError a subclass of StandardErrorKazuki Tsujimoto2020-12-231-1/+1
|
* Data: delete卜部昌平2020-12-221-1/+1
| | | | | | | | Has been deprecated since 684bdf6171b76f5bc5e4f05926a5ab01ec2b4fd5. Matz says in [ruby-core:83954] that Data should be an alias of Object. Because rb_cData has not been deprecated, let us deprecate the constant to make it a C-level synonym of rb_cObject.
* Use category: :experimental in warnings that are related to experimental ↵Jeremy Evans2020-12-181-0/+14
| | | | | | | | | features This adds rb_category_compile_warn in order to emit compiler warnings with categories. Note that Ripper currently ignores the category for these warnings, but by default it ignores the warnings completely, so this shouldn't matter.
* Make warning_categories a map of category symbols to category numbersJeremy Evans2020-12-181-15/+12
| | | | | | | Use this to simplify rb_warning_category_from_name. This also adds support for using the :experimental category in Kernel#warn and Warning.warn.
* Switch rb_category_warn{,ing} to accept an rb_warning_category_tJeremy Evans2020-12-181-4/+12
| | | | | | | | | | Since we decided to only allowing specific warning categories, there is no reason to have an API that accepts a general string, as it is more error-prone. Switch to only allowing the specific warning categories. As rb_category_warn{,ing} are public API, this requires making rb_warning_category_t public API as well.
* Cache warning category IDsNobuyoshi Nakada2020-12-151-4/+8
|
* Help RDoc find Exception [ci skip]Alan Wu2020-12-141-0/+2
| | | | This was on top of `Init_Exception()`.