it's just about style.
if (error) {
   console.log(error)
   return
}
if (error2) {
   console.log (erorr2)
   return
}

real;
code;
goes;
here;


looks better than:
if (error) {
   log
} else if (error2) {
  log2
} else {
   real code
   if (error3) {
    log3
   } else {
     more real code...
}
}


On 21 April 2013 01:56, Tomas Neme <notifications@github.com> wrote:

> In server.js:
>
> > +            emit();
> > +        });
> > +        db.collection('lists').findEach({ "models._id": status.piece[pos]._id }, function(err, res) {
> > +            if( res ) {
> > +                var piece = _.chain(res.models).filter(
> function(p) {
> > +                    return p._id == status.piece[pos]._id;
> > +                }).value();
> > +                console.log("[mosto status] filtered pieces", piece)
> > +                if( !piece )
> > +                    console.log("[mosto status] error: this shouldn't be empty");
> > +                else if( piece.length != 1 )
> > +                    console.log("[mosto status] error: there must only be one!");
> > +                else { // good
> > +                    piece = piece[0];
> > +                    status.piece[pos] = piece;
> > +                    // default name to id
>
> same answer as before. I can't really imagine what better error handling
> that logging could I have. If anyone can think of something, I'll be happy
> to oblige
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/inaes-tic/mbc-caspa/pull/119/files#r3886462>
> .
>



-- 
Niv Sardi