Like this project? it on
When things go awry, Blitz will throw a number of specific exceptions to indicate the type of error that has happened. For most database operations, the exception model is modeled after the one used in the Django web development framework.
Gets raised when you try to retrieve an object from the database (typically using the get function of the backend) that does not exist.
Keep in Mind
Like the MultipleDocumentsReturned exception, this exception is specific to the document class for which it is raised.
class Author(Document): pass class Book(Document): pass try: raise Book.DoesNotExist except Author.DoesNotExist: #this will NOT catch the Book.DoesNotExist exception! print "got Author.DoesNotExist exception!" except Book.DoesNotExist: print "got Book.DoesNotExist exception!"
Gets raised when a query that should return only a single object (e.g. the get function of the backend) finds more than one matching document in the database. Like the DoesNotExist exception, it is specific to the document class for which it is raised.
Transaction errors get raised if functions that are supposed to run only inside a transaction get called outside of a transaction, or vice-versa. Please note that not all backends currently support database transactions.
Gets raised if a function that must only be used inside a database transaction gets called outside a transaction.
Gets raised if a function that must only be used outside a database transaction gets called inside a transaction.