From 6765de593670bbdd86a6ac5faba78692ef37e1c1 Mon Sep 17 00:00:00 2001 From: HF Date: Mon, 1 Aug 2022 23:18:16 +0200 Subject: [PATCH] import error handling of whois --- src/core/isProxy.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/core/isProxy.js b/src/core/isProxy.js index 4d61e88..ba72d1b 100644 --- a/src/core/isProxy.js +++ b/src/core/isProxy.js @@ -116,12 +116,16 @@ async function dummy() { } async function saveIPInfo(ip, isProxy, info) { - const whoisData = await whois(ip); - IPInfo.upsert({ - ...whoisData, - isProxy, - pcheck: info, - }); + try { + const whoisData = await whois(ip); + IPInfo.upsert({ + ...whoisData, + isProxy, + pcheck: info, + }); + } catch (error) { + logger.error(`Error whois for ${ip}: ${error.message}`); + } } /*