Closed adamramadhan closed 5 years ago
What exactly do you want to do with that line?
Number(data[data.length - 6].replace(';; Query time: ', '').replace(' msec', ''));
I got the same issue. When dig command internally generate a timeout or the final host is not accesible.
When DIG return a timeout message it will not throw any error, just a normal response like this:
; <<>> DiG 9.12.2-P1 <<>> @ns50162.webempresa.eu. A fit3d.me ; (1 server found) ;; global options: +cmd ;; connection timed out; no servers could be reached
In your code, in the index.js in line 45 you always try to read data[data.length - 6]
that position doesn't exist when DIG return a timeout message or any other issue.
I think you should add a try catch, or validate the length of the data array. If the valid conditions are not met, you should throw an error and then reject the promise.
esult.time = Number(data[data.length - 6].replace(';; Query time: ', '').replace(' msec', '')); ^ TypeError: Cannot read property 'replace' of undefined
using a simple script
anyone have the same problem?