} catch (NSValidation.ValidationException ex) {
setErrorMessage(ERXLocalizer.currentLocalizer().localizedTemplateStringForKeyWithObject("CouldNotSave", ex));
validationFailedWithException(ex, ex.object(), "saveChangesExceptionKey");
} catch(EOGeneralAdaptorException ex) {
if(ERXEOAccessUtilities.isOptimisticLockingFailure(ex) && shouldRecoverFromOptimisticLockingFailure()) {
EOEnterpriseObject eo = ERXEOAccessUtilities.refetchFailedObject(ec, ex);
setErrorMessage(ERXLocalizer.currentLocalizer().localizedTemplateStringForKeyWithObject("CouldNotSavePleaseReapply", d2wContext()));
validationFailedWithException(ex, eo, "CouldNotSavePleaseReapply");
} else if(ERXEOAccessUtilities.isUniqueFailure(ex)) {
EOEnterpriseObject eo = ERXEOAccessUtilities.refetchFailedObject(ec, ex);
setErrorMessage(ERXLocalizer.currentLocalizer().localizedTemplateStringForKeyWithObject("DatabaseUniqException", d2wContext()));
validationFailedWithException(ex, eo, "DatabaseUniqException");
} else {
throw ex;
}