Sha256: 8d6875e864bb18f752bab701f6d2f73a9f0016472b18aed26f54a92288a91547
Contents?: true
Size: 623 Bytes
Versions: 15
Compression:
Stored size: 623 Bytes
Contents
# frozen_string_literal: true class Grumlin::Repository::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
Version data entries
15 entries across 15 versions & 1 rubygems