Skip to content

Commit

Permalink
Revert "refactor: improve error handling"
Browse files Browse the repository at this point in the history
This reverts commit 1fb605f.
  • Loading branch information
ChristopherPHolder committed Jan 27, 2024
1 parent 549c7c7 commit bd76cf8
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions packages/nx-plugin/src/executors/user-flow/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import {CLI_MODES} from "@push-based/user-flow";
import {logger} from "@nrwl/devkit";


export default async function runExecutor(
options: UserFlowExecutorSchema,
context?: ExecutorContext & UserFlowExecutorSchema
): Promise<{ success: boolean, output: string }> {
export default async function runExecutor(options: UserFlowExecutorSchema, context?: ExecutorContext & UserFlowExecutorSchema) {
options.interactive = options.interactive !== undefined;
const verbose = !!options.verbose;

Expand All @@ -18,22 +15,18 @@ export default async function runExecutor(
const cliArgs = ['npx @push-based/user-flow collect'].concat(processParamsToParamsArray(options as any)).join(' ');

verbose && console.log('Execute: ', cliArgs);

let processOutput: Buffer | Error;
let processResult;
let output;
let success = true;
try {
processOutput = execSync(cliArgs);
} catch (error: unknown) {
if (error instanceof Error) {
processOutput = error;
} else {
processOutput = new Error(String(error));
}
processResult = execSync(cliArgs)
output = processResult.toString()
}
catch (e) {
success = false;
output = e.toString();
}
const success = !(processOutput instanceof Error);
const output = processOutput.toString();

verbose && console.log('Result: ', output);

return {
success,
output
Expand Down

0 comments on commit bd76cf8

Please sign in to comment.