MCPcopy Create free account
hub / github.com/code-pushup/cli / stringifyError

Function stringifyError

tools/eslint-formatter-multi/src/lib/utils.ts:7–18  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

5import type { FormatterConfig } from './types.js';
6
7export function stringifyError(error: unknown): string {
8 if (error instanceof Error) {
9 if (error.name === 'Error' || error.message.startsWith(error.name)) {
10 return error.message;
11 }
12 return `${error.name}: ${error.message}`;
13 }
14 if (typeof error === 'string') {
15 return error;
16 }
17 return JSON.stringify(error);
18}
19
20export function getExtensionForFormat(format: EslintFormat): string {
21 const extensionMap: Record<string, string> = {

Callers 2

findConfigFromEnvFunction · 0.70
persistEslintReportFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected