From 6a4d38bec4a7b0c8e8ba20efdc3556030112d861 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; }