Sha256: e48d838b41a01f595b825653ef428ceec92d0296bb94d74b1e63031e651fcf89
Contents?: true
Size: 767 Bytes
Versions: 20
Compression:
Stored size: 767 Bytes
Contents
# frozen_string_literal: true module Grumlin module Repository class ErrorHandlingStrategy def initialize(mode: :retry, **params) @mode = mode @params = params @on_exceptions = params[:on] end def raise? @mode == :raise end def ignore? @mode == :ignore end def retry? @mode == :retry end def apply!(&block) return yield if raise? return ignore_errors!(&block) if ignore? retry_errors!(&block) end private def ignore_errors! yield rescue *@on_exceptions # ignore errors end def retry_errors!(&block) Retryable.retryable(**@params, &block) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems