| author | |
| committer | |
| log | b49a2e677c6fba6d705ad16dbd913f56df4035d6 |
| tree | 099b741cbc582ce313b98260a50927f2aa44d20f |
| parent | ed81c156daf3d8ce7d3599236df7a26c11ef145f |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>2 files changed, 4 insertions(+), 4 deletions(-)
apps/web/src/components/preview/PreviewUnreachable.tsx+1-1| ... | @@ -17,7 +17,7 @@ interface Props { | ... | @@ -17,7 +17,7 @@ interface Props { |
| 17 | export function PreviewUnreachable({ url, code, description, onReload }: Props) { | 17 | export function PreviewUnreachable({ url, code, description, onReload }: Props) { |
| 18 | const [showDetails, setShowDetails] = useState(false); | 18 | const [showDetails, setShowDetails] = useState(false); |
| 19 | const host = safeHost(url) ?? url; | 19 | const host = safeHost(url) ?? url; |
| 20 | const friendly = describePreviewError(code, description); | 20 | const friendly = describePreviewError(description); |
| 21 | const errorLabel = description.length > 0 ? description : `ERR_${Math.abs(code) || "FAILED"}`; | 21 | const errorLabel = description.length > 0 ? description : `ERR_${Math.abs(code) || "FAILED"}`; |
| 22 | 22 | ||
| 23 | return ( | 23 | return ( |
apps/web/src/components/preview/errorCodeMessages.ts+3-3| ... | @@ -2,11 +2,11 @@ import { PREVIEW_ERROR_CODE_MESSAGES } from "./previewConstants"; | ... | @@ -2,11 +2,11 @@ import { PREVIEW_ERROR_CODE_MESSAGES } from "./previewConstants"; |
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * Resolve a friendly description for a Chromium / network error. Falls back | 4 | * Resolve a friendly description for a Chromium / network error. Falls back |
| 5 | * to the description string passed in when the code isn't in our table. | 5 | * to the description string passed in when it isn't in our table. |
| 6 | */ | 6 | */ |
| 7 | export function describePreviewError(code: number, description: string): string { | 7 | export function describePreviewError(description: string): string { |
| 8 | const friendly = PREVIEW_ERROR_CODE_MESSAGES[description]; | 8 | const friendly = PREVIEW_ERROR_CODE_MESSAGES[description]; |
| 9 | if (friendly) return friendly; | 9 | if (friendly) return friendly; |
| 10 | if (description.length > 0) return description; | 10 | if (description.length > 0) return description; |
| 11 | return `Network error (${code})`; | 11 | return "Network error"; |
| 12 | } | 12 | } |