Improve error handling
This commit is contained in:
parent
99f4ab7000
commit
4260ec713f
1 changed files with 5 additions and 0 deletions
|
@ -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はクライアントエラーであり、それはつまり
|
||||
|
|
Loading…
Reference in a new issue