summaryrefslogtreecommitdiff
path: root/lib/error_highlight/core_ext.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/error_highlight/core_ext.rb')
-rw-r--r--lib/error_highlight/core_ext.rb9
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