Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Fix message catching the field for which a duplicate key error ocurred
Browse files Browse the repository at this point in the history
  • Loading branch information
igorauad committed Jul 20, 2015
1 parent 5d4d7ce commit 0efc82d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0efc82d

Please sign in to comment.