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,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)