Sha256: f60bae64c821e316ad58bc878cc75c528533023d2f4e0a65e7c8d9a98e1c16d0

Contents?: true

Size: 635 Bytes

Versions: 8

Compression:

Stored size: 635 Bytes

Contents

module Dry
  class Struct
    # Raised when given input doesn't conform schema and constructor type
    Error = Class.new(TypeError)

    # Raised when defining duplicate attributes
    class RepeatedAttributeError < ArgumentError
      # @param [Symbol] key
      #   attribute name that is the same as previously defined one
      def initialize(key)
        super("Attribute :#{key} has already been defined")
      end
    end

    # Raised when a struct doesn't have an attribute
    class MissingAttributeError < KeyError
      def initialize(key)
        super("Missing attribute: #{ key.inspect }")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dry-struct-1.2.0 lib/dry/struct/errors.rb
dry-struct-1.1.1 lib/dry/struct/errors.rb
dry-struct-1.1.0 lib/dry/struct/errors.rb
dry-struct-1.0.0 lib/dry/struct/errors.rb
dry-struct-0.7.0 lib/dry/struct/errors.rb
dry-struct-0.6.0 lib/dry/struct/errors.rb
dry-struct-0.5.1 lib/dry/struct/errors.rb
dry-struct-0.5.0 lib/dry/struct/errors.rb