[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
This commit is contained in:
Yusuke Endoh 2022-11-14 14:36:24 +09:00 committed by git
parent 96d29dff66
commit 8bfd4dd4e1

View File

@ -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