Module: RBS::DetailedMessageable
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
CyclicClassAliasDefinitionError ,
CyclicTypeParameterBound ,
DuplicatedInterfaceMethodDefinitionError ,
DuplicatedMethodDefinitionError ,
InconsistentClassModuleAliasError ,
InheritModuleError ,
InvalidOverloadMethodError ,
InvalidVarianceAnnotationError ,
MixinClassError ,
NoMixinFoundError ,
NoSelfTypeFoundError ,
NoTypeFoundError ,
NonregularTypeAliasError ,
ParsingError ,
RecursiveAliasDefinitionError ,
RecursiveTypeAliasError ,
TypeParamDefaultReferenceError ,
UnknownMethodAliasError ,
WillSyntaxError
| |
Defined in: | lib/rbs/errors.rb |
Instance Method Summary
Instance Method Details
#detailed_message(highlight: false)
[ GitHub ]# File 'lib/rbs/errors.rb', line 24
def (highlight: false, **) msg = if Exception.method_defined?(: ) super else # Failback to `#message` in Ruby 3.1 or earlier "#{} (#{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 marker = "^" * ([location.end_column - location.start_column, 1].max or raise) io = StringIO.new io.puts msg io.puts io.print "\e[1m" if highlight io.puts " #{location.buffer.lines[location.end_line - 1]}" io.puts " #{indent}#{marker}" io.print "\e[m" if highlight io.string end