Skip to content

Commit

Permalink
Don't use a subclass for minimongo errors; they print poorly.
Browse files Browse the repository at this point in the history
Fixes #1246.
  • Loading branch information
glasser committed Jul 26, 2013
1 parent 3dd8c23 commit 26163ce
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/minimongo/minimongo.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@ LocalCollection._applyChanges = function (doc, changeFields) {
});
};

LocalCollection.MinimongoError = function (message) {
var self = this;
self.name = "MinimongoError";
self.details = message;
var MinimongoError = function (message) {
var e = new Error(message);
e.name = "MinimongoError";
return e;
};

LocalCollection.MinimongoError.prototype = new Error;


// options may include sort, skip, limit, reactive
// sort may be any of these forms:
Expand Down Expand Up @@ -431,7 +429,7 @@ LocalCollection.prototype.insert = function (doc, callback) {
var id = LocalCollection._idStringify(doc._id);

if (_.has(self.docs, doc._id))
throw new LocalCollection.MinimongoError("Duplicate _id '" + doc._id + "'");
throw MinimongoError("Duplicate _id '" + doc._id + "'");

self._saveOriginal(id, undefined);
self.docs[id] = doc;
Expand Down

0 comments on commit 26163ce

Please sign in to comment.