(
err: AppError | NormalizedError,
options: { showDetails?: boolean } = {},
)
| 32 | } |
| 33 | |
| 34 | export function printHumanError( |
| 35 | err: AppError | NormalizedError, |
| 36 | options: { showDetails?: boolean } = {}, |
| 37 | ): void { |
| 38 | const normalized = err instanceof AppError ? normalizeError(err) : err; |
| 39 | process.stderr.write(`Error (${normalized.code}): ${normalized.message}\n`); |
| 40 | if (normalized.hint) { |
| 41 | process.stderr.write(`Hint: ${normalized.hint}\n`); |
| 42 | } |
| 43 | if (normalized.diagnosticId) { |
| 44 | process.stderr.write(`Diagnostic ID: ${normalized.diagnosticId}\n`); |
| 45 | } |
| 46 | if (normalized.logPath) { |
| 47 | process.stderr.write(`Diagnostics Log: ${normalized.logPath}\n`); |
| 48 | } |
| 49 | if (options.showDetails && normalized.details) { |
| 50 | process.stderr.write(`${JSON.stringify(normalized.details, null, 2)}\n`); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | type SnapshotDiffLine = { |
| 55 | kind?: 'added' | 'removed' | 'unchanged'; |
no test coverage detected