Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

replace next() with LOG.error in the callbacks

  • Loading branch information...
commit 802a6df5fb1ce3771ef6055f1ffd3be309962a4d 1 parent df0363a
mason authored

Showing 1 changed file with 8 additions and 4 deletions. Show diff stats Hide diff stats

  1. +8 4 app/libs/topic_hooks.js
12 app/libs/topic_hooks.js
@@ -59,7 +59,8 @@ module.exports = {
59 59 { _id : this.user },
60 60 { $pull : { topics : this._id }},
61 61 function ( err ){
62   - if( err ) next( err );
  62 + if( err ) LOG.error( 500,
  63 + '[libs][topic_hooks][pre_remove] Having trouble removing topic\'s id from its user', err );
63 64 });
64 65
65 66 // remove topic's _id from its tags
@@ -68,18 +69,21 @@ module.exports = {
68 69 { $pull : { topics : this._id }},
69 70 { multi : true },
70 71 function ( err ){
71   - if( err ) next( err );
  72 + if( err ) LOG.error( 500,
  73 + '[libs][topic_hooks][pre_remove] Having trouble removing topic\'s id from its tags', err );
72 74 });
73 75
74 76 // remove topic comments' _ids from their users
75 77 Comment.find(
76 78 { _id : { $in : this.comments }},
77 79 function ( err, comments ){
78   - if( err ) return next( err );
  80 + if( err ) LOG.error( 500,
  81 + '[libs][topic_hooks][pre_remove] Having trouble find topic\'s comments', err );
79 82
80 83 comments.forEach( function ( comment ){
81 84 comment.remove( function ( err, comment ){
82   - if( err ) next( err );
  85 + if( err ) LOG.error( 500,
  86 + '[libs][topic_hooks][pre_remove] Having trouble removing topic comments\' ids from their users', err );
83 87 });
84 88 });
85 89 });

0 comments on commit 802a6df

Please sign in to comment.
Something went wrong with that request. Please try again.