outmoded / sntp

SNTP client (RFC4330) for node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error not throw when host is not found

j-a-m-l opened this issue · comments

commented

This code:

try {
  const time = await Sntp.time({ host: 'notime.unknown.not', timeout })
} catch (err) {
}

wouldn't throw an Error, but establish time as:

{ Error: getaddrinfo ENOTFOUND notime.unknown.not
        at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
      message: 'getaddrinfo ENOTFOUND notime.unknown.not',
      errno: 'ENOTFOUND',
      code: 'ENOTFOUND',
      syscall: 'getaddrinfo',
      hostname: 'notime.unknown.not' }

It works correctly here: https://github.com/hueniverse/sntp/blob/master/test/index.js#L56

If you can create a failing test, I'll take a deeper look.

commented

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.