diff --git a/src/sfCommand.ts b/src/sfCommand.ts index 41dfc4396..a4560bcc3 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; }