Exception: CSVConverter::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/csv_converter.rb

Overview

Error holds error messages as well as details of the data being processed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, details = {}) ⇒ Error

A new instance of Error.

Parameters:

  • message (String)

    the error description

  • details (Hash) (defaults to: {})

    info about the data being proccesed at the time of the error



43
44
45
46
# File 'lib/csv_converter.rb', line 43

def initialize(message, details = {})
  @details = details
  super("#{message} on: #{details}")
end

Instance Attribute Details

#detailsHash (readonly)

Details of the data being processed when the error happened. By default this includes:

filename: the name of the file being processed
row_num: number of the row being processed
entity: the name of the entity being processed as provided in the mappings
row: the raw data of the row being processed
attr: the name of the attribute being processed as provided in the mappings

Additionally it contains all the options provided to the converter in the mappings.

Returns:

  • (Hash)


38
39
40
# File 'lib/csv_converter.rb', line 38

def details
  @details
end