code: function printResult(val) {
    var err = val.error ? val.error.toString() : 'no error';
    //console.log(util.inspect(val,{depth:null}));
    console.log(err);
  }
docs: ====================================== and test it out...