Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

replace next() with LOG.error in the callbacks

  • Loading branch information...
commit 802a6df5fb1ce3771ef6055f1ffd3be309962a4d 1 parent df0363a
mason authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 app/libs/topic_hooks.js
View
12 app/libs/topic_hooks.js
@@ -59,7 +59,8 @@ module.exports = {
{ _id : this.user },
{ $pull : { topics : this._id }},
function ( err ){
- if( err ) next( err );
+ if( err ) LOG.error( 500,
+ '[libs][topic_hooks][pre_remove] Having trouble removing topic\'s id from its user', err );
});
// remove topic's _id from its tags
@@ -68,18 +69,21 @@ module.exports = {
{ $pull : { topics : this._id }},
{ multi : true },
function ( err ){
- if( err ) next( err );
+ if( err ) LOG.error( 500,
+ '[libs][topic_hooks][pre_remove] Having trouble removing topic\'s id from its tags', err );
});
// remove topic comments' _ids from their users
Comment.find(
{ _id : { $in : this.comments }},
function ( err, comments ){
- if( err ) return next( err );
+ if( err ) LOG.error( 500,
+ '[libs][topic_hooks][pre_remove] Having trouble find topic\'s comments', err );
comments.forEach( function ( comment ){
comment.remove( function ( err, comment ){
- if( err ) next( err );
+ if( err ) LOG.error( 500,
+ '[libs][topic_hooks][pre_remove] Having trouble removing topic comments\' ids from their users', err );
});
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.