From b4f66ee9256c784f5d0fdf4aaef456bf63f25bf0 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はクライアントエラーであり、それはつまり