From 592e13b77b0dc7b036ce217aaadd527fc7e87cc5 Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Sun, 3 Mar 2024 08:49:46 +0800 Subject: [PATCH] return null if error --- src/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index b4232ae..17b2fce 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -20,5 +20,7 @@ export const testUrls = async (urls?: string[]) => { if (!urls?.length || (await canUseGoogle)) { return null; } - return Promise.race(urls.map((url) => ping(url).then(() => url))); + return Promise.race(urls.map((url) => ping(url).then(() => url))).catch( + () => null, + ); };