lib/rbs/errors.rb in rbs-3.1.3 vs lib/rbs/errors.rb in rbs-3.2.0.pre.1
- old
+ new
@@ -20,10 +20,17 @@
class LoadingError < BaseError; end
class DefinitionError < BaseError; end
module DetailedMessageable
def detailed_message(highlight: false, **)
- msg = super
+ msg = if Exception.method_defined?(:detailed_message)
+ super
+ else
+ # Failback to `#message` in Ruby 3.1 or earlier
+ "#{message} (#{self.class.name})"
+ end
+
+ return msg unless location
# Support only one line
return msg unless location.start_line == location.end_line
indent = " " * location.start_column