FieldExpected

class FieldExpected(received)

Is raised when a Document is created with an attribute that is not a BaseField.

>>> raise FieldExpected(str)
Expected instance of BaseField, got str!
Parameters:received – The received type

TypeMismatch

class TypeMismatch(expected, received)

Is raised when an incorrect type was supplied.

>>> raise TypeMismatch(int, str)
Expected instance of int, got str!
Parameters:
  • expected – The expected type.
  • received – The received type

FieldNotFound

class FieldNotFound(field_name, document)

Is raised when trying to access a property that isn’t present as a field.

>>> raise FieldNotFound(doc, 'attr')
Field 'attr' was not found on object     <ExampleDocument name='Changed My Name' number=15>.
Parameters:
  • field_name (str) – Name of the field
  • document (BaseDocument) – The document that was being accessed.

RetryLimitReached

class RetryLimitReached(limit, document)

Is raised during the synchronisation process if the specified retry limit is reached.

>>> raise RetryLimitReached(10, doc)
Reached the retry limit (10) while trying to save     <ExampleDocument name='Changed My Name' number=15>.
Parameters:
  • limit (int) – The retry limit
  • received (BaseDocument) – The document that couldn’t be synced

UnresolvableReference

class UnresolvableReference

Is raised when a reference can not be set/loaded.

>>> raise UnresolvableReference()
Only inserted documents can be referenced.