From cf31fbec5d7c1cd657b1dd188bd52ced4c40bba5 Mon Sep 17 00:00:00 2001 From: Patryk Kuniczak Date: Fri, 13 Feb 2026 13:18:37 +0100 Subject: [PATCH] chore: add missing `async` to network.ts (#2107) --- packages/wxt/src/core/utils/network.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/wxt/src/core/utils/network.ts b/packages/wxt/src/core/utils/network.ts index fbeef4ac..f111161a 100644 --- a/packages/wxt/src/core/utils/network.ts +++ b/packages/wxt/src/core/utils/network.ts @@ -1,12 +1,18 @@ import dns from 'node:dns'; import { ResolvedConfig } from '../../types'; import { withTimeout } from './time'; +import consola from 'consola'; -function isOffline(): Promise { - const isOffline = new Promise((res) => { - dns.resolve('google.com', (err) => res(err != null)); - }); - return withTimeout(isOffline, 1e3).catch(() => true); +async function isOffline(): Promise { + try { + const isOffline = new Promise((res) => { + dns.resolve('google.com', (err) => res(err != null)); + }); + return await withTimeout(isOffline, 1e3); + } catch (error) { + consola.error('Error checking offline status:', error); + return true; + } } export async function isOnline(): Promise {