diff --git a/mongoengine/document.py b/mongoengine/document.py index 59bea359..b47490bd 100644 --- a/mongoengine/document.py +++ b/mongoengine/document.py @@ -280,7 +280,9 @@ class Document(BaseDocument): kwargs.update(cascade_kwargs) kwargs['_refs'] = _refs self.cascade_save(**kwargs) - + except pymongo.errors.DuplicateKeyError, err: + message = u'Tried to save duplicate unique keys (%s)' + raise NotUniqueError(message % unicode(err)) except pymongo.errors.OperationFailure, err: message = 'Could not save document (%s)' if re.match('^E1100[01] duplicate key', unicode(err)):