From ecd9a5863c90c633f1df9c18fe39fa77fe0f9d23 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Tue, 2 Nov 2021 22:48:54 +0200 Subject: [PATCH] debug(phisherman): gracefully handle and log unexpected API responses --- backend/src/data/Phisherman.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/src/data/Phisherman.ts b/backend/src/data/Phisherman.ts index 24073bd8..c50f67b1 100644 --- a/backend/src/data/Phisherman.ts +++ b/backend/src/data/Phisherman.ts @@ -130,6 +130,11 @@ async function fetchDomainInfo(domain: string): Promise>("GET", `/v2/domains/info/${domain}`); const domainInfo = result[domain]; + if (!domainInfo) { + // tslint:disable-next-line:no-console + console.warn("Unexpected Phisherman API response:", result); + return null; + } if (domainInfo.classification === "unknown") { return null; }