(error: ArticlePageData['error'])
| 1 | import type { ArticlePageData } from '$lib/types'; |
| 2 | |
| 3 | export 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected