Exception: Uinit::Sig::ParameterTypeError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/uinit/sig/parameter_type_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parameter, type_error) ⇒ ParameterTypeError

Returns a new instance of ParameterTypeError.



6
7
8
9
10
11
12
13
# File 'lib/uinit/sig/parameter_type_error.rb', line 6

def initialize(parameter, type_error)
  super()

  @parameter = parameter
  @type_error = type_error

  set_backtrace(type_error.backtrace)
end

Instance Attribute Details

#parameterObject (readonly)

Returns the value of attribute parameter.



15
16
17
# File 'lib/uinit/sig/parameter_type_error.rb', line 15

def parameter
  @parameter
end

#type_errorObject (readonly)

Returns the value of attribute type_error.



15
16
17
# File 'lib/uinit/sig/parameter_type_error.rb', line 15

def type_error
  @type_error
end

Instance Method Details

#messageObject



17
18
19
20
21
22
23
# File 'lib/uinit/sig/parameter_type_error.rb', line 17

def message
  method = parameter.method
  file, line = method.method_origin.source_location

  "Type error on parameter '#{parameter.name}' " \
    "in method '#{method.method_name}' at '#{file}:#{line}', detail:\n#{type_error.message}"
end