Fix message catching the field for which a duplicate key error ocurred

This commit is contained in:
Igor Freire
2015-07-20 14:38:44 -03:00
parent 5d4d7cecfe
commit 0efc82db0f

View File

@@ -7,7 +7,7 @@ var getUniqueErrorMessage = function(err) {
var output;
try {
var fieldName = err.err.substring(err.err.lastIndexOf('.$') + 2, err.err.lastIndexOf('_1'));
var fieldName = err.errmsg.substring(err.errmsg.lastIndexOf('.$') + 2, err.errmsg.lastIndexOf('_1'));
output = fieldName.charAt(0).toUpperCase() + fieldName.slice(1) + ' already exists';
} catch(ex) {