class Cascade::ErrorHandler
Constants
- DEFAULT_ERROR_STORE
- HANDLING_EXCEPTIONS
Public Class Methods
new(options = {})
click to toggle source
# File lib/cascade/error_handler.rb, line 11 def initialize(options = {}) @error_store = options.fetch(:error_store) { DEFAULT_ERROR_STORE } @raise_parse_errors = options.fetch(:raise_parse_errors, false) @handling_exceptions = options.fetch(:handling_exceptions) do HANDLING_EXCEPTIONS end end
Public Instance Methods
with_errors_handling(row) { || ... }
click to toggle source
Runs passed block with catching throwing errors and storing in ErrorStore
@param row [Hash] the object retrieved from CSV to store it in case of problems with processing
# File lib/cascade/error_handler.rb, line 23 def with_errors_handling(row) yield rescue *@handling_exceptions => exception @error_store.call(row, exception) raise exception if @raise_parse_errors end