Exception: AdsCommon::Errors::TypeMismatchError

Inherits:
Error
  • Object
show all
Defined in:
lib/ads_common/errors.rb

Overview

Raised if the type of the object provided does not match expected type.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected, provided, field_name) ⇒ TypeMismatchError

Returns a new instance of TypeMismatchError.



76
77
78
# File 'lib/ads_common/errors.rb', line 76

def initialize(expected, provided, field_name)
  @expected, @provided, @field_name = expected, provided, field_name
end

Instance Attribute Details

#expectedObject (readonly)

Returns the value of attribute expected.



75
76
77
# File 'lib/ads_common/errors.rb', line 75

def expected
  @expected
end

#field_nameObject (readonly)

Returns the value of attribute field_name.



75
76
77
# File 'lib/ads_common/errors.rb', line 75

def field_name
  @field_name
end

#providedObject (readonly)

Returns the value of attribute provided.



75
76
77
# File 'lib/ads_common/errors.rb', line 75

def provided
  @provided
end

Instance Method Details

#to_sObject



79
80
81
82
# File 'lib/ads_common/errors.rb', line 79

def to_s()
  return "%s: expected: '%s', provided: '%s' for field '%s'" %
      [super, @expected, @provided, @field_name]
end