Skip to content

Commit fc990a6

Browse files
committed
refactor: fix build
1 parent ff74241 commit fc990a6

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/nx-plugin/src/executors/cli/executor.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,25 @@ import { executeProcess } from '../../internal/execute-process.js';
33
import {
44
createCliCommandObject,
55
createCliCommandString,
6-
formatCommandLog,
7-
objectToCliArgs,
86
} from '../internal/cli.js';
97
import { normalizeContext } from '../internal/context.js';
108
import type { AutorunCommandExecutorOptions } from './schema.js';
119
import { mergeExecutorOptions, parseAutorunExecutorOptions } from './utils.js';
1210

11+
export function stringifyError(error: unknown): string {
12+
// TODO: special handling for ZodError instances
13+
if (error instanceof Error) {
14+
if (error.name === 'Error' || error.message.startsWith(error.name)) {
15+
return error.message;
16+
}
17+
return `${error.name}: ${error.message}`;
18+
}
19+
if (typeof error === 'string') {
20+
return error;
21+
}
22+
return JSON.stringify(error);
23+
}
24+
1325
export type ExecutorOutput = {
1426
success: boolean;
1527
command?: string;

0 commit comments

Comments
 (0)