MCPcopy Create free account
hub / github.com/Freedium-cfd/web / getErrorMessage

Function getErrorMessage

new-web/src/lib/utils/errorFormatter.ts:3–16  ·  view source on GitHub ↗
(error: ArticlePageData['error'])

Source from the content-addressed store, hash-verified

1import type { ArticlePageData } from '$lib/types';
2
3export function getErrorMessage(error: ArticlePageData['error']): string {
4 if (!error) return '';
5
6 switch (error.code) {
7 case 'ARTICLE_NOT_FOUND':
8 return "We couldn't find the article you're looking for.";
9 case 'RENDER_ERROR':
10 return 'There was a problem preparing this article.';
11 case 'COMPILE_ERROR':
12 return 'There was a problem processing the article content.';
13 default:
14 return error.message || 'An unexpected error occurred.';
15 }
16}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected