Sha256: e2ad9e4589fab12c24690c3c5873f6f930e36a27f9af0afc2e2bd1c11ec29559

Contents?: true

Size: 1.64 KB

Versions: 4

Compression:

Stored size: 1.64 KB

Contents

# frozen_string_literal: true

module VerbotenKeys
  module Errors
    class ForbiddenKeysMustBeAnArrayError < StandardError
      def initialize(invalid_forbidden_keys)
        invalid_forbidden_keys_string = invalid_forbidden_keys&.to_s || 'nil'
        invalid_forbidden_keys_class = invalid_forbidden_keys.class.to_s
        super("VerbotenKeys' forbidden_keys must be an array of symbols. You passed in #{invalid_forbidden_keys_string}, which was a #{invalid_forbidden_keys_class}.")
      end
    end

    class ForbiddenKeysMustOnlyContainSymbolsError < StandardError
      def initialize(invalid_forbidden_keys, invalid_forbidden_key)
        invalid_forbidden_key_string = invalid_forbidden_key&.to_s || 'nil'
        invalid_forbidden_key_class = invalid_forbidden_key.class.to_s
        super("VerbotenKeys' forbidden_keys must be an array of symbols. You passed in #{invalid_forbidden_keys}, which included #{invalid_forbidden_key_string}, which was a #{invalid_forbidden_key_class}")
      end
    end

    class StrategyMustBeASymbolError < StandardError
      def initialize(invalid_strategy)
        invalid_strategy_string = invalid_strategy&.to_s || 'nil'
        invalid_strategy_class = invalid_strategy.class.to_s
        super("VerbotenKeys' strategy must be a symbol. You passed in #{invalid_strategy_string}, which was a #{invalid_strategy_class}.")
      end
    end

    class StrategyNotFoundError < StandardError
      def initialize(invalid_strategy)
        super("VerbotenKeys' strategy must be a valid option. You passed in :#{invalid_strategy}, but the only valid options are: #{VerbotenKeys::Configuration::STRATEGIES}.")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
verboten_keys-1.1.1 lib/verboten_keys/errors.rb
verboten_keys-1.1.0 lib/verboten_keys/errors.rb
verboten_keys-1.0.1 lib/verboten_keys/errors.rb
verboten_keys-1.0.0 lib/verboten_keys/errors.rb