Module: RBS::Test::Errors
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Exceptions:
| |
Defined in: | lib/rbs/test/errors.rb |
Class Method Summary
Class Method Details
.format_param(param)
[ GitHub ]# File 'lib/rbs/test/errors.rb', line 22
def self.format_param(param) if param.name "`#{param.type}` (#{param.name})" else "`#{param.type}`" end end
.inspect_(obj)
[ GitHub ].to_string(error)
[ GitHub ]# File 'lib/rbs/test/errors.rb', line 38
def self.to_string(error) method = "#{error.klass.name}#{error.method_name}" case error when ArgumentTypeError "[#{method}] ArgumentTypeError: expected #{format_param error.param} but given `#{inspect_(error.value)}`" when BlockArgumentTypeError "[#{method}] BlockArgumentTypeError: expected #{format_param error.param} but given `#{inspect_(error.value)}`" when ArgumentError "[#{method}] ArgumentError: expected method type #{error.method_type}" when BlockArgumentError "[#{method}] BlockArgumentError: expected method type #{error.method_type}" when ReturnTypeError "[#{method}] ReturnTypeError: expected `#{error.type}` but returns `#{inspect_(error.value)}`" when BlockReturnTypeError "[#{method}] BlockReturnTypeError: expected `#{error.type}` but returns `#{inspect_(error.value)}`" when UnexpectedBlockError "[#{method}] UnexpectedBlockError: unexpected block is given for `#{error.method_type}`" when MissingBlockError "[#{method}] MissingBlockError: required block is missing for `#{error.method_type}`" when UnresolvedOverloadingError "[#{method}] UnresolvedOverloadingError: couldn't find a suitable overloading" else raise "Unexpected error: #{inspect_(error)}" end end