Skip to content

Commit

Permalink
refactor: Object.assign() is the move here
Browse files Browse the repository at this point in the history
  • Loading branch information
kanadgupta committed Nov 17, 2024
1 parent 2190a61 commit 2acb945
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ export async function captureOutput<T>(fn: () => Promise<unknown>, opts?: Captur
}
} catch (error) {
return {
...(error instanceof Errors.CLIError && {error: {...error, message: toString(error.message)}}),
...(error instanceof Error && {error}),
...(error instanceof Errors.CLIError && {error: Object.assign(error, {message: toString(error.message)})}),
...(error instanceof Error && {error: Object.assign(error, {message: toString(error.message)})}),
stderr: getStderr(),
stdout: getStdout(),
}
Expand Down

0 comments on commit 2acb945

Please sign in to comment.