From 4adc3318cbacef9a93610c7a3eaa3c7b1b1e1fbb Mon Sep 17 00:00:00 2001 From: f-w Date: Sun, 11 Apr 2021 05:43:59 -0700 Subject: [PATCH] fix exception handling for last ip --- package.json | 2 +- src/controllers/base.controller.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 317d7b093..a33abdee3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notify-bc", - "version": "2.6.1", + "version": "2.6.2", "dbSchemaVersion": "0.8.0", "description": "A versatile notification API server", "keywords": [ diff --git a/src/controllers/base.controller.ts b/src/controllers/base.controller.ts index 946ff3bc5..154e508dc 100644 --- a/src/controllers/base.controller.ts +++ b/src/controllers/base.controller.ts @@ -136,7 +136,7 @@ export class BaseController { throw ex; } // do client retry if there are multiple addresses - for (const address of addresses) { + for (const [index, address] of addresses.entries()) { const newSmtpCfg = Object.assign({}, smtpCfg, {host: address.address}); const newTransporter = this.nodemailer.createTransport(newSmtpCfg); try { @@ -146,6 +146,7 @@ export class BaseController { } } catch (newEx) { if ( + index < addresses.length - 1 && newEx.command === 'CONN' && ['ECONNECTION', 'ETIMEDOUT'].indexOf(newEx.code) >= 0 ) {