Fix a silly bug in error management (in case the error does not come from request)

This commit is contained in:
Godzil 2018-07-27 21:22:12 +01:00
parent 141bdccf02
commit 0b54549c64

View File

@ -46,10 +46,13 @@ export default function(config: IConfig, task: IConfigTask, done: (err: any) =>
if (errP) if (errP)
{ {
const reqErr = errP.error; const reqErr = errP.error;
if ((reqErr !== undefined) && (reqErr.syscall))
{
if ((reqErr.syscall === 'getaddrinfo') && (reqErr.errno === 'ENOTFOUND')) if ((reqErr.syscall === 'getaddrinfo') && (reqErr.errno === 'ENOTFOUND'))
{ {
log.error('The URL \'' + task.address + '\' is invalid, please check => I\'m ignoring it.'); log.error('The URL \'' + task.address + '\' is invalid, please check => I\'m ignoring it.');
} }
}
return done(errP); return done(errP);
} }
@ -69,11 +72,14 @@ export default function(config: IConfig, task: IConfigTask, done: (err: any) =>
{ {
/* Check if domain is valid */ /* Check if domain is valid */
const reqErr = errD.error; const reqErr = errD.error;
if ((reqErr !== undefined) && (reqErr.syscall))
{
if ((reqErr.syscall === 'getaddrinfo') && (reqErr.errno === 'ENOTFOUND')) if ((reqErr.syscall === 'getaddrinfo') && (reqErr.errno === 'ENOTFOUND'))
{ {
page.episodes[i].retry = 0; page.episodes[i].retry = 0;
log.error('The URL \'' + task.address + '\' is invalid, please check => I\'m ignoring it.'); log.error('The URL \'' + task.address + '\' is invalid, please check => I\'m ignoring it.');
} }
}
if (page.episodes[i].retry <= 0) if (page.episodes[i].retry <= 0)
{ {