From 4260ec713fa51a7e50a09445dfe0a23840b63f9e Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 6 Aug 2018 21:48:23 +0900 Subject: [PATCH] Improve error handling --- src/queue/processors/http/deliver.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/queue/processors/http/deliver.ts b/src/queue/processors/http/deliver.ts index e06866da4..75e46559d 100644 --- a/src/queue/processors/http/deliver.ts +++ b/src/queue/processors/http/deliver.ts @@ -7,6 +7,11 @@ export default async (job: bq.Job, done: any): Promise => { await request(job.data.user, job.data.to, job.data.content); done(); } catch (res) { + if (!res.hasOwnProperty('statusCode')) { + console.warn(`deliver failed (unknown): ${res}`); + return done(); + } + if (res.statusCode == null) return done(); if (res.statusCode >= 400 && res.statusCode < 500) { // HTTPステータスコード4xxはクライアントエラーであり、それはつまり