Sha256: e26374d06b25119a3d1e8ebdc88699ec540a9f312d468396a71db206200f7ff5
Contents?: true
Size: 920 Bytes
Versions: 34
Compression:
Stored size: 920 Bytes
Contents
# frozen_string_literal: true module Karafka module Processing # A simple object that allows us to keep track of processing state. # It allows to indicate if given thing moved from success to a failure or the other way around # Useful for tracking consumption state class Result attr_reader :cause def initialize @success = true @cause = false end # @return [Boolean] def success? @success end # Marks state as successful def success! @success = true # We set cause to false so the previous error that occurred does not leak when error is # no longer present @cause = false end # Marks state as failure # @param cause [StandardError] error that occurred and caused failure def failure!(cause) @success = false @cause = cause end end end end
Version data entries
34 entries across 34 versions & 1 rubygems