diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2022-11-14 14:36:24 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-11-14 06:06:12 +0000 |
commit | 8bfd4dd4e15a9ac3a308c3c45db629e74fae9b0c (patch) | |
tree | c38724440a1a8c76f84fd9acbad72beb4edfede9 /lib/error_highlight | |
parent | 96d29dff66a0d2e045d09ce6bb7bb3b382c59c2c (diff) | |
download | ruby-8bfd4dd4e15a9ac3a308c3c45db629e74fae9b0c.tar.gz |
[ruby/error_highlight] Enable ErrorHighlight for TypeError/ArgumentError only after Ruby 3.2
... because changing TypeError#message and ArgumentError#message is
highly incompatible.
https://github.com/ruby/error_highlight/commit/39aa897c7a
Diffstat (limited to 'lib/error_highlight')
-rw-r--r-- | lib/error_highlight/core_ext.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/error_highlight/core_ext.rb b/lib/error_highlight/core_ext.rb index 00d5671648..b69093f74e 100644 --- a/lib/error_highlight/core_ext.rb +++ b/lib/error_highlight/core_ext.rb @@ -37,6 +37,11 @@ module ErrorHighlight end NameError.prepend(CoreExt) - TypeError.prepend(CoreExt) - ArgumentError.prepend(CoreExt) + + if Exception.method_defined?(:detailed_message) + # ErrorHighlight is enabled for TypeError and ArgumentError only when Exception#detailed_message is available. + # This is because changing ArgumentError#message is highly incompatible. + TypeError.prepend(CoreExt) + ArgumentError.prepend(CoreExt) + end end |