Exception: Krikri::Mapping::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Krikri::Mapping::Error
- Defined in:
- lib/krikri/mapping.rb
Overview
An error class for exceptions thrown during ‘Krikri::Mapping` processes.
Collects the full set of errors encountered when mapping a given record, along with the property names that were being processed when throwing the error.
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#original_record ⇒ Object
Returns the value of attribute original_record.
Instance Method Summary collapse
- #add(property, parent_error) ⇒ Object
-
#initialize(record) ⇒ Error
constructor
A new instance of Error.
-
#message ⇒ String
A message describing the full error set.
-
#properties ⇒ Array<Symbol>
The property names that caused errors.
Constructor Details
#initialize(record) ⇒ Error
Returns a new instance of Error.
84 85 86 87 |
# File 'lib/krikri/mapping.rb', line 84 def initialize(record) @original_record = record @errors = {} end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
80 81 82 |
# File 'lib/krikri/mapping.rb', line 80 def errors @errors end |
#original_record ⇒ Object
Returns the value of attribute original_record.
80 81 82 |
# File 'lib/krikri/mapping.rb', line 80 def original_record @original_record end |
Instance Method Details
#add(property, parent_error) ⇒ Object
92 93 94 |
# File 'lib/krikri/mapping.rb', line 92 def add(property, parent_error) errors[property] = parent_error end |
#message ⇒ String
Returns a message describing the full error set.
104 105 106 107 108 109 110 111 112 |
# File 'lib/krikri/mapping.rb', line 104 def msg = "Error processing mapping for #{original_record.local_name}\n" errors.each do |property, error| msg << "Failed on property #{property}:\n" msg << "\t#{error.}\n\t#{error.backtrace.join("\n\t")}" end msg end |
#properties ⇒ Array<Symbol>
Returns the property names that caused errors.
98 99 100 |
# File 'lib/krikri/mapping.rb', line 98 def properties errors.keys end |