9b8564d9a8
Signed-off-by: Marcos Tapajós <tapajos@gmail.com>
26 lines
690 B
Ruby
26 lines
690 B
Ruby
# encoding: utf-8
|
|
module CouchRest
|
|
module Model
|
|
module Errors
|
|
|
|
class CouchRestModelError < StandardError; end
|
|
|
|
# Raised when a persisence method ending in ! fails validation. The message
|
|
# will contain the full error messages from the +Document+ in question.
|
|
#
|
|
# Example:
|
|
#
|
|
# <tt>Validations.new(person.errors)</tt>
|
|
class Validations < CouchRestModelError
|
|
attr_reader :document
|
|
def initialize(document)
|
|
@document = document
|
|
super("Validation Failed: #{@document.errors.full_messages.join(", ")}")
|
|
end
|
|
end
|
|
end
|
|
|
|
class DocumentNotFound < Errors::CouchRestModelError; end
|
|
end
|
|
end
|