Module: Taro::Types::Shared::Errors
- Defined in:
- lib/taro/types/shared/errors.rb
Instance Method Summary collapse
- #coerce_error_message(msg, value) ⇒ Object
- #input_error(msg, value = object) ⇒ Object
- #response_error(msg, value = object) ⇒ Object
Instance Method Details
#coerce_error_message(msg, value) ⇒ Object
10 11 12 13 14 |
# File 'lib/taro/types/shared/errors.rb', line 10 def (msg, value) type_class = is_a?(Taro::Types::Field) ? self.type : self.class type_desc = type_class.name.sub(/^Taro::Types::.*?([^:]+)$/, '\1') "#{value.class} is not valid as #{type_desc}: #{msg}" end |
#input_error(msg, value = object) ⇒ Object
2 3 4 |
# File 'lib/taro/types/shared/errors.rb', line 2 def input_error(msg, value = object) raise Taro::InputError.new((msg, value), value, self) end |
#response_error(msg, value = object) ⇒ Object
6 7 8 |
# File 'lib/taro/types/shared/errors.rb', line 6 def response_error(msg, value = object) raise Taro::ResponseError.new((msg, value), value, self) end |