fix undefined vars in server - misplaced conditions (#2)
This commit is contained in:
parent
0a6747f2d8
commit
1ab0d4fa31
1 changed files with 8 additions and 8 deletions
16
server.js
16
server.js
|
@ -194,14 +194,14 @@ router.post('/find-one-update', function(req, res, next) {
|
||||||
var p = new Person(req.body);
|
var p = new Person(req.body);
|
||||||
p.save(function(err, pers) {
|
p.save(function(err, pers) {
|
||||||
if(err) { return next(err) }
|
if(err) { return next(err) }
|
||||||
if(!data) {
|
|
||||||
console.log('Missing `done()` argument');
|
|
||||||
return next({message: 'Missing callback argument'});
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
update(pers.name, function(err, data) {
|
update(pers.name, function(err, data) {
|
||||||
clearTimeout(t);
|
clearTimeout(t);
|
||||||
if(err) { return next(err) }
|
if(err) { return next(err) }
|
||||||
|
if (!data) {
|
||||||
|
console.log('Missing `done()` argument');
|
||||||
|
return next({ message: 'Missing callback argument' });
|
||||||
|
}
|
||||||
res.json(data);
|
res.json(data);
|
||||||
p.remove();
|
p.remove();
|
||||||
});
|
});
|
||||||
|
@ -283,14 +283,14 @@ router.post('/query-tools', function(req, res, next) {
|
||||||
if(err) if(err) { return next(err) }
|
if(err) if(err) { return next(err) }
|
||||||
Person.create(req.body, function(err, pers) {
|
Person.create(req.body, function(err, pers) {
|
||||||
if(err) { return next(err) }
|
if(err) { return next(err) }
|
||||||
if(!data) {
|
|
||||||
console.log('Missing `done()` argument');
|
|
||||||
return next({message: 'Missing callback argument'});
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
chain(function(err, data) {
|
chain(function(err, data) {
|
||||||
clearTimeout(t);
|
clearTimeout(t);
|
||||||
if(err) { return next(err) }
|
if(err) { return next(err) }
|
||||||
|
if (!data) {
|
||||||
|
console.log('Missing `done()` argument');
|
||||||
|
return next({ message: 'Missing callback argument' });
|
||||||
|
}
|
||||||
res.json(data);
|
res.json(data);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue