Sha256: 048fb0ed7fc6426411088199851a43177fa642ebc6146c07dd8ee988b4fb6b10

Contents?: true

Size: 703 Bytes

Versions: 3

Compression:

Stored size: 703 Bytes

Contents

module Toy
  class Error < StandardError; end

  class AttributeNotDefined < Error; end

  class RecordInvalid < Error
    attr_reader :record
    def initialize(record)
      @record = record
      super("Invalid record: #{@record.errors.full_messages.to_sentence}")
    end
  end

  class NotFound < Error
    def initialize(*args)
      super("Could not find document with: #{args.inspect}")
    end
  end

  class InvalidKeyFactory < Error
    def initialize(name_or_factory)
      super("#{name_or_factory.inspect} is not a valid name and did not respond to next_key and key_type")
    end
  end

  class InvalidKey < Error
    def initialize(*)
      super("Key may not be nil")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
toystore-0.13.2 lib/toy/exceptions.rb
toystore-0.13.1 lib/toy/exceptions.rb
toystore-0.13.0 lib/toy/exceptions.rb