回答編集履歴

1

エラーの処理周りをちょっと修正

2017/12/07 07:22

投稿

miyabi-sun
miyabi-sun

スコア21158

test CHANGED
@@ -62,7 +62,7 @@
62
62
 
63
63
  host: 'api.line.me',
64
64
 
65
- path: '/v2/bot/message/' + it.object + '/content',
65
+ path: `/v2/bot/message/${it.object}/content`,
66
66
 
67
67
  headers: {
68
68
 
@@ -84,7 +84,7 @@
84
84
 
85
85
  .on('data', chunk => { data.push(new Buffer(chunk)) })
86
86
 
87
- .on('error', err => { console.log(err) })
87
+ .on('error', err => { done(err, null) })
88
88
 
89
89
  .on('end', () => {
90
90
 
@@ -106,11 +106,13 @@
106
106
 
107
107
  async.series(functions, (err, results) => {
108
108
 
109
+ if (err) console.error(err);
110
+
109
111
  // results内にdoneの第二引数の配列が詰まっているはずなので確認してください。
110
112
 
111
113
  console.log(results);
112
114
 
113
- console.log(results.filter(it => Boolean(it))); // Null除去
115
+ console.log(results.filter(it => it != null)); // Null除去
114
116
 
115
117
  });
116
118