mirror of
https://github.com/tiennm99/old-free-domains.git
synced 2026-10-15 06:16:17 +00:00
feat: second error catch
This commit is contained in:
1 parent
a3725187cd
commit
65af93a166
1 file changed
+2
@@ -6,6 +6,8 @@ const ping = (host) => {
|
||||
exec(`ping -c 1 ${host}`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else if (stderr.match(/(unknown|unreachable|failure)/i)) {
|
||||
reject(new Error(`Host unreachable: ${host}`));
|
||||
} else {
|
||||
resolve({ stdout, stderr });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user