Exception: FlexColumns::Errors::JsonTooLongError

Inherits:
DataError
  • Object
show all
Defined in:
lib/flex_columns/errors.rb

Overview

Raised when you try to store enough data in a flex column that the generated JSON is too long to fit into the column.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_source, limit, json_string) ⇒ JsonTooLongError

Returns a new instance of JsonTooLongError.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/flex_columns/errors.rb', line 75

def initialize(data_source, limit, json_string)
  @data_source = data_source
  @limit = limit
  @json_string = json_string

  super(%{When trying to serialize JSON for #{data_source.describe_flex_column_data_source},
the JSON produced was too long to fit in the database.
We produced #{json_string.length} characters of JSON, but the
database's limit for that column is #{limit} characters.

The JSON we produced was:

  #{FlexColumns::Util::StringUtils.abbreviated_string(json_string)}})
end

Instance Attribute Details

#data_sourceObject (readonly)

Returns the value of attribute data_source.



73
74
75
# File 'lib/flex_columns/errors.rb', line 73

def data_source
  @data_source
end

#json_stringObject (readonly)

Returns the value of attribute json_string.



73
74
75
# File 'lib/flex_columns/errors.rb', line 73

def json_string
  @json_string
end

#limitObject (readonly)

Returns the value of attribute limit.



73
74
75
# File 'lib/flex_columns/errors.rb', line 73

def limit
  @limit
end