lib/portal/config.rb in sidekiq_portal-0.1.1 vs lib/portal/config.rb in sidekiq_portal-0.2.0

- old
+ new

@@ -19,16 +19,37 @@ # # @api private # @since 0.1.0 DEFAUL_RETRIES_COUNT = 0 + # @return [Array<Exception>] + # + # @api private + # @since 0.1.0 + RETRY_ON_EXCEPTIONS = [StandardError].freeze + + # @since 0.1.0 setting :default_timezone, DEFAULT_TIMEZONE - setting :retries_count, DEFAUL_RETRIES_COUNT + # @since 0.1.0 + setting :retry_count, DEFAUL_RETRIES_COUNT + # @since 0.1.0 + setting :retry_on, RETRY_ON_EXCEPTIONS + # @since 0.1.0 setting :scheduler_config, EMPTY_SCHEDULER_CONFIG + # @since 0.1.0 validate :default_timezone do |value| value.is_a?(String) && !ActiveSupport::TimeZone[value].nil? end - validate :retries_count, :integer, strict: true + # @since 0.1.0 + validate :retry_on do |value| + value.is_a?(Array) && (value.all? do |exception_klass| + exception_klass.is_a?(Class) && exception_klass <= ::Exception + end) + end + + # @since 0.1.0 + validate :retry_count, :integer, strict: true + # @since 0.1.0 validate :scheduler_config, :hash, strict: true end