class NxtPipeline::ErrorCallback

Attributes

callback[RW]
errors[RW]

Public Class Methods

new(errors, halt_on_error, &callback) click to toggle source
# File lib/nxt_pipeline/error_callback.rb, line 3
def initialize(errors, halt_on_error, &callback)
  @errors = errors.any? ? errors : [StandardError]
  @halt_on_error = halt_on_error
  @callback = callback
end

Public Instance Methods

applies_to_error?(error) click to toggle source
# File lib/nxt_pipeline/error_callback.rb, line 19
def applies_to_error?(error)
  (error.class.ancestors & errors).any?
end
call(step, arg, error) click to toggle source
# File lib/nxt_pipeline/error_callback.rb, line 23
def call(step, arg, error)
  callback.call(step, arg, error)
end
continue_after_error?() click to toggle source
# File lib/nxt_pipeline/error_callback.rb, line 15
def continue_after_error?
  !halt_on_error?
end
halt_on_error?() click to toggle source
# File lib/nxt_pipeline/error_callback.rb, line 11
def halt_on_error?
  @halt_on_error
end