Exception: StrokeDB::InvalidDocumentError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/strokedb/document.rb

Overview

Raised when Document#save! is called on an invalid document (for which doc.valid? returns false)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document) ⇒ InvalidDocumentError

Returns a new instance of InvalidDocumentError.



45
46
47
# File 'lib/strokedb/document.rb', line 45

def initialize(document)
  @document = document
end

Instance Attribute Details

#documentObject (readonly)

:nodoc:



43
44
45
# File 'lib/strokedb/document.rb', line 43

def document
  @document
end

Instance Method Details

#inspectObject



53
54
55
# File 'lib/strokedb/document.rb', line 53

def inspect
  "#<#{self.class.name}: #{message}>"
end

#messageObject



49
50
51
# File 'lib/strokedb/document.rb', line 49

def message
  "Validation failed: #{@document.errors.messages.join(", ")}"
end