class FlexColumns::Errors::UnparseableJsonInDatabaseError
Raised when the data in the database is not parseable as JSON (via JSON.parse). Note that we take special care to exclude characters from the message that aren’t in a valid encoding, as this is one of the major causes of JSON parsing failures in some situations…and we really don’t want to create an exception that itself has a message with encoding problems.
Attributes
source_exception[R]
Public Class Methods
new(data_source, raw_string, source_exception)
click to toggle source
Calls superclass method
FlexColumns::Errors::InvalidDataInDatabaseError::new
# File lib/flex_columns/errors.rb, line 157 def initialize(data_source, raw_string, source_exception) @source_exception = source_exception super(data_source, raw_string) end
Private Instance Methods
create_message()
click to toggle source
Calls superclass method
FlexColumns::Errors::InvalidDataInDatabaseError#create_message
# File lib/flex_columns/errors.rb, line 163 def create_message source_message = source_exception.message if source_message.respond_to?(:force_encoding) source_message.force_encoding("UTF-8") source_message = source_message.chars.select { |c| c.valid_encoding? }.join end super + %{, we got an exception: #{source_message} (#{source_exception.class.name})} end