Exception: ClickhouseRuby::TypeCastError

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

Overview

Type conversion errors Raised when there are issues converting between Ruby and ClickHouse types

Instance Attribute Summary collapse

Attributes inherited from Error

#original_error

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, from_type: nil, to_type: nil, value: nil) ⇒ TypeCastError

Returns a new instance of TypeCastError.

Parameters:

  • message (String) (defaults to: nil)

    the error message

  • from_type (String, nil) (defaults to: nil)

    the source type

  • to_type (String, nil) (defaults to: nil)

    the target type

  • value (Object, nil) (defaults to: nil)

    the value that failed conversion



103
104
105
106
107
108
# File 'lib/clickhouse_ruby/errors.rb', line 103

def initialize(message = nil, from_type: nil, to_type: nil, value: nil)
  @from_type = from_type
  @to_type = to_type
  @value = value
  super(message)
end

Instance Attribute Details

#from_typeString? (readonly)

Returns the source type.

Returns:

  • (String, nil)

    the source type



91
92
93
# File 'lib/clickhouse_ruby/errors.rb', line 91

def from_type
  @from_type
end

#to_typeString? (readonly)

Returns the target type.

Returns:

  • (String, nil)

    the target type



94
95
96
# File 'lib/clickhouse_ruby/errors.rb', line 94

def to_type
  @to_type
end

#valueObject? (readonly)

Returns the value that couldn’t be converted.

Returns:

  • (Object, nil)

    the value that couldn’t be converted



97
98
99
# File 'lib/clickhouse_ruby/errors.rb', line 97

def value
  @value
end