Skip to content

Commit 56cf11e

Browse files
committed
refactor: use error helper
1 parent 1592f62 commit 56cf11e

File tree

1 file changed

+8
-4
lines changed
  • tools/eslint-formatter-multiple-formats/src/lib

1 file changed

+8
-4
lines changed

tools/eslint-formatter-multiple-formats/src/lib/utils.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { ESLint } from 'eslint';
22
import { mkdirSync, writeFileSync } from 'node:fs';
33
import path from 'node:path';
4+
import { stringifyError } from '@code-pushup/utils';
45
import type { EslintFormat, FormatterConfig } from './types.js';
56

67
// Import the stylish formatter - using require, otherwise there is the wrong typing
@@ -28,10 +29,10 @@ export function findConfigFromEnv(
2829

2930
try {
3031
return JSON.parse(configString) as FormatterConfig;
31-
} catch (error_) {
32+
} catch (error) {
3233
console.error(
3334
'Error parsing ESLINT_FORMATTER_CONFIG environment variable:',
34-
(error_ as Error).message,
35+
stringifyError(error),
3536
);
3637
return null;
3738
}
@@ -89,9 +90,12 @@ export function persistEslintReport(
8990
console.info(`ESLint report (${format}) written to: ${outputDir}`);
9091
}
9192
return true;
92-
} catch (error_) {
93+
} catch (error) {
9394
if (verbose) {
94-
console.error('There was a problem writing the output file:\n%s', error_);
95+
console.error(
96+
'There was a problem writing the output file:\n%s',
97+
stringifyError(error),
98+
);
9599
}
96100
return false;
97101
}

0 commit comments

Comments
 (0)