diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-08-06 21:48:23 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-08-06 21:48:23 +0900 |
| commit | 4260ec713fa51a7e50a09445dfe0a23840b63f9e (patch) | |
| tree | e5825e3c57b3dc1d34220aad518221b9dbc9599e /src/queue | |
| parent | :v: (diff) | |
| download | sharkey-4260ec713fa51a7e50a09445dfe0a23840b63f9e.tar.gz sharkey-4260ec713fa51a7e50a09445dfe0a23840b63f9e.tar.bz2 sharkey-4260ec713fa51a7e50a09445dfe0a23840b63f9e.zip | |
Improve error handling
Diffstat (limited to 'src/queue')
| -rw-r--r-- | src/queue/processors/http/deliver.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/queue/processors/http/deliver.ts b/src/queue/processors/http/deliver.ts index e06866da4e..75e46559dd 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<void> => { 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はクライアントエラーであり、それはつまり |