Class: DataAnon::Core::TableErrors
- Inherits:
-
Object
- Object
- DataAnon::Core::TableErrors
- Includes:
- Utils::Logging
- Defined in:
- lib/core/table_errors.rb
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(table_name) ⇒ TableErrors
constructor
A new instance of TableErrors.
- #log_error(record, exception) ⇒ Object
- #print ⇒ Object
Methods included from Utils::Logging
Constructor Details
#initialize(table_name) ⇒ TableErrors
Returns a new instance of TableErrors.
7 8 9 10 |
# File 'lib/core/table_errors.rb', line 7 def initialize table_name @table_name = table_name @errors = [] end |
Instance Method Details
#errors ⇒ Object
17 18 19 |
# File 'lib/core/table_errors.rb', line 17 def errors @errors end |
#log_error(record, exception) ⇒ Object
12 13 14 15 |
# File 'lib/core/table_errors.rb', line 12 def log_error record, exception @errors << { :record => record, :exception => exception} raise 'Reached limit of error for a table' if @errors.length > 100 end |
#print ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/core/table_errors.rb', line 21 def print return if @errors.length == 0 logger.error("Errors while processing table '#{@table_name}':") @errors.each do |error| logger.error(error[:exception]) logger.error(error[:exception].backtrace.join("\n\t")) end end |