1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

return null if error

This commit is contained in:
sunnylqm 2024-03-03 08:49:46 +08:00
parent 2845a4302a
commit 592e13b77b
No known key found for this signature in database

View File

@ -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,
);
};