| 1 | import { 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 it isn't in our table. |
| 6 | */ |
| 7 | export function describePreviewError(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"; |
| 12 | } |