Sha256: eacf13caad03bc0fd5992e6d2eb098d8e67927f79475a624e16c59cc7c69221c

Contents?: true

Size: 658 Bytes

Versions: 11

Compression:

Stored size: 658 Bytes

Contents

module Toy
  class Error < StandardError; 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

11 entries across 11 versions & 1 rubygems

Version Path
toystore-0.10.1 lib/toy/exceptions.rb
toystore-0.10.0 lib/toy/exceptions.rb
toystore-0.9.0 lib/toy/exceptions.rb
toystore-0.8.3 lib/toy/exceptions.rb
toystore-0.8.2 lib/toy/exceptions.rb
toystore-0.8.1 lib/toy/exceptions.rb
toystore-0.8.0 lib/toy/exceptions.rb
toystore-0.7.0 lib/toy/exceptions.rb
toystore-0.6.6 lib/toy/exceptions.rb
toystore-0.6.5 lib/toy/exceptions.rb
toystore-0.6.4 lib/toy/exceptions.rb