Sha256: 0fd38f2c374734ed984ae0ec0ac9e50c83aefd85014850181c9c9e865869e205

Contents?: true

Size: 701 Bytes

Versions: 5

Compression:

Stored size: 701 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(id)
      super("Could not find document with id: #{id.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

5 entries across 5 versions & 1 rubygems

Version Path
toystore-0.12.0 lib/toy/exceptions.rb
toystore-0.11.0 lib/toy/exceptions.rb
toystore-0.10.4 lib/toy/exceptions.rb
toystore-0.10.3 lib/toy/exceptions.rb
toystore-0.10.2 lib/toy/exceptions.rb