Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

errorCodeMessages.ts

12 lines489 Bytes

1import { PREVIEW_ERROR_CODE_MESSAGES } from "./previewConstants";
2​
3/**
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.
6 */
7export function describePreviewError(code: number, description: string): string {
8 const friendly = PREVIEW_ERROR_CODE_MESSAGES[description];
9 if (friendly) return friendly;
10 if (description.length > 0) return description;
11 return `Network error (${code})`;