Sha256: 4d8ac4c595a2b741dda9fbf54b19056a59182ce1c7ba43b0a7e673a34f43e22b

Contents?: true

Size: 762 Bytes

Versions: 2

Compression:

Stored size: 762 Bytes

Contents

# frozen_string_literal: true

module Dingtalk
  module Client
    # Basic exception
    class Error < StandardError; end

    # :nodoc:
    class ConfigurationError < Error
      attr_reader :key, :value, :valid_values

      def initialize(key, value, valid_values)
        @key          = key
        @valud        = value
        @valid_values = valid_values
        valid_values_str = Array(valid_values).join(', ')
        message = if value.blank?
                    "#{key} not configured or configured with blank value, valid_values: #{valid_values_str}"
                  else
                    "Configure #{key} with value #{value} failed, valid_values: #{valid_values_str}"
                  end
        super(message)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dingtalk-client-0.2.1 lib/dingtalk/client/errors.rb
dingtalk-client-0.2.0 lib/dingtalk/client/errors.rb