Skip to content

Commit

Permalink
duplicate entries in mongo returns DuplicateEntryError
Browse files Browse the repository at this point in the history
  • Loading branch information
wshager committed Apr 9, 2013
1 parent 6b62110 commit 4e8859b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions store/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ var convertNodeAsyncFunction = require('promised-io/promise').convertNodeAsyncFu
defer = require("promised-io/promise").defer,
when = require("promised-io/promise").when,
jsArray = require("rql/js-array"),
PreconditionFailed = require("../errors").PreconditionFailed;
PreconditionFailed = require("../errors").PreconditionFailed,
DuplicateEntryError = require('perstore/errors').DuplicateEntryError;

var RQ = require("rql/parser");
//RQ.converters["default"] = exports.converters.auto;
Expand Down Expand Up @@ -278,7 +279,7 @@ module.exports = function(options){
deferred.resolve(obj.id);
});
} else {
deferred.reject(id + " exists, and can't be overwritten");
deferred.reject(new DuplicateEntryError(id + " exists, and can't be overwritten"));
}
});
} else {
Expand Down

0 comments on commit 4e8859b

Please sign in to comment.