Skip to content

Commit 7ddc143

Browse files
only21milcodex
andcommitted
fix(web): report invalid preview addresses
Co-Authored-By: GPT-6.1 Sol <[email protected]>
1 parent e14dd53 commit 7ddc143

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

‎apps/web/src/components/preview/PreviewView.tsx‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
} from "@t3tools/contracts";
1919
import {
2020
normalizePreviewUrl,
21+
isPreviewUrlNormalizationError,
2122
resolveAddressBarInput,
2223
previewPdfAssetUrl,
2324
resolveSearchUrlTemplate,
@@ -289,7 +290,17 @@ export function PreviewView({
289290
if (await navigateToResolvedUrl(resolved)) {
290291
recordVisitForThread(threadRef, resolved);
291292
}
292-
} catch {}
293+
} catch (error) {
294+
toastManager.add({
295+
type: "error",
296+
title: "Could not open this address",
297+
description: isPreviewUrlNormalizationError(error)
298+
? "Enter an http or https URL."
299+
: error instanceof Error
300+
? error.message
301+
: "An error occurred.",
302+
});
303+
}
293304
};
294305

295306
const handleOpenServerUrl = async (next: string) => {
@@ -301,7 +312,17 @@ export function PreviewView({
301312
if (await navigateToResolvedUrl(resolved)) {
302313
recordVisitForThread(threadRef, next);
303314
}
304-
} catch {}
315+
} catch (error) {
316+
toastManager.add({
317+
type: "error",
318+
title: "Could not open this address",
319+
description: isPreviewUrlNormalizationError(error)
320+
? "Enter an http or https URL."
321+
: error instanceof Error
322+
? error.message
323+
: "An error occurred.",
324+
});
325+
}
305326
};
306327

307328
const handleRefresh = () => {

0 commit comments

Comments
 (0)