Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

Commit

Permalink
updating to new feathers errors. Closes #3.
Browse files Browse the repository at this point in the history
  • Loading branch information
ekryski committed Jun 13, 2014
1 parent f2b35fb commit 110e7ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 35 deletions.
30 changes: 0 additions & 30 deletions lib/errors.js

This file was deleted.

11 changes: 6 additions & 5 deletions lib/mongodb.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var Proto = require('uberproto');
var mongo = require('mongoskin');
var errors = require('feathers').errors.types;
var _ = require('lodash');

// TODO (EK): Does order matter for how these filters
Expand Down Expand Up @@ -120,7 +121,7 @@ var MongoService = Proto.extend({

if (_.isFunction(id)){
cb = id;
return cb(new Error('An string or number id must be provided'));
return cb(new errors.BadRequest('An string or number id must be provided'));
}

if (_.isFunction(params)){
Expand All @@ -135,7 +136,7 @@ var MongoService = Proto.extend({
}

if (!this.collection) {
return cb(new Error('No collection specified'));
return cb(new errors.GeneralError('No collection specified'));
}

this.store.collection(this.collection).findById(id, params.query, cb);
Expand All @@ -149,7 +150,7 @@ var MongoService = Proto.extend({
}

if (!this.collection) {
return cb(new Error('No collection specified'));
return cb(new errors.GeneralError('No collection specified'));
}

this.store.collection(this.collection).insert(data, params, function(error, data) {
Expand All @@ -169,7 +170,7 @@ var MongoService = Proto.extend({
}

if (!this.collection) {
return cb(new Error('No collection specified'));
return cb(new errors.GeneralError('No collection specified'));
}

this.store.collection(this.collection).updateById(id, data, params, function(error) {
Expand All @@ -189,7 +190,7 @@ var MongoService = Proto.extend({
}

if (!this.collection) {
return cb(new Error('No collection specified'));
return cb(new errors.GeneralError('No collection specified'));
}

this.store.collection(this.collection).removeById(id, params.query, cb);
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
"mongoskin": "^0.6.1",
"uberproto": "~1.1.0"
},
"peerDependencies": {
"feathers": ">=1.0.x"
},
"devDependencies": {
"feathers": ">=1.0.x",
"chai": "^1.7.2",
"database-cleaner": "~0.7.0",
"grunt": "^0.4.5",
Expand Down

0 comments on commit 110e7ee

Please sign in to comment.