Sha256: d6aa4d2a431ef97782c49c619a3ed7e72d22c840cc90d6129cab0fdea44615e6

Contents?: true

Size: 667 Bytes

Versions: 3

Compression:

Stored size: 667 Bytes

Contents

module Toy
  class Error < StandardError; end

  class RecordInvalidError < 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 UndefinedLock < Error
    def initialize(klass, name)
      super("Undefined lock :#{name} for class #{klass.name}")
    end
  end

  class AdapterNoLocky < Error
    def initialize(adapter)
      super("#{adapter.name.to_s.capitalize} adapter does not support locking")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
toystore-0.6.1 lib/toy/exceptions.rb
toystore-0.6 lib/toy/exceptions.rb
toystore-0.5 lib/toy/exceptions.rb