From 0b54549c6440a54258c436eb2b718f8de22d5ccc Mon Sep 17 00:00:00 2001 From: Godzil Date: Fri, 27 Jul 2018 21:22:12 +0100 Subject: [PATCH] Fix a silly bug in error management (in case the error does not come from request) --- src/series.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/series.ts b/src/series.ts index e27e0f5..2d17830 100644 --- a/src/series.ts +++ b/src/series.ts @@ -46,9 +46,12 @@ export default function(config: IConfig, task: IConfigTask, done: (err: any) => if (errP) { const reqErr = errP.error; - if ((reqErr.syscall === 'getaddrinfo') && (reqErr.errno === 'ENOTFOUND')) + if ((reqErr !== undefined) && (reqErr.syscall)) { - log.error('The URL \'' + task.address + '\' is invalid, please check => I\'m ignoring it.'); + if ((reqErr.syscall === 'getaddrinfo') && (reqErr.errno === 'ENOTFOUND')) + { + log.error('The URL \'' + task.address + '\' is invalid, please check => I\'m ignoring it.'); + } } return done(errP); @@ -69,10 +72,13 @@ export default function(config: IConfig, task: IConfigTask, done: (err: any) => { /* Check if domain is valid */ const reqErr = errD.error; - if ((reqErr.syscall === 'getaddrinfo') && (reqErr.errno === 'ENOTFOUND')) + if ((reqErr !== undefined) && (reqErr.syscall)) { - page.episodes[i].retry = 0; - log.error('The URL \'' + task.address + '\' is invalid, please check => I\'m ignoring it.'); + if ((reqErr.syscall === 'getaddrinfo') && (reqErr.errno === 'ENOTFOUND')) + { + page.episodes[i].retry = 0; + log.error('The URL \'' + task.address + '\' is invalid, please check => I\'m ignoring it.'); + } } if (page.episodes[i].retry <= 0)