From ac385c0bc16da5c50e53a8d39f582e592f5a1ed3 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Mon, 24 Apr 2023 10:03:18 -0600 Subject: [PATCH] fix: emit sfCommandError event (#240) * fix: emit sfCommandError event * fix: store parsed flags on class * chore: remove uneccessary canges --------- Co-authored-by: Cristian Dominguez --- src/sfCommand.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sfCommand.ts b/src/sfCommand.ts index 41dfc439..a4560bcc 100644 --- a/src/sfCommand.ts +++ b/src/sfCommand.ts @@ -483,6 +483,10 @@ export abstract class SfCommand extends Command { // @ts-expect-error because skipOclifErrorHandling is not on SfError err.skipOclifErrorHandling = true; + // Emit an event for plugin-telemetry prerun hook to pick up. + // @ts-expect-error because TS is strict about the events that can be emitted on process. + process.emit('sfCommandError', err); + throw err; }