From 20d3c7d6a318eeecf1c17f808f2e52a156a592b9 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Wed, 8 Feb 2023 13:29:31 -0700 Subject: [PATCH] feat: add param to runHook to capture errors --- src/config/config.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/config/config.ts b/src/config/config.ts index e973ec7cf..3adb495dc 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -230,7 +230,12 @@ export class Config implements IConfig { } } - public async runHook(event: T, opts: Hooks[T]['options'], timeout?: number): Promise> { + public async runHook( + event: T, + opts: Hooks[T]['options'], + timeout?: number, + captureErrors?: boolean, + ): Promise> { debug('start %s hook', event) const search = (m: any): Hook => { if (typeof m === 'function') return m @@ -293,6 +298,7 @@ export class Config implements IConfig { } catch (error: any) { final.failures.push({plugin: p, error: error as Error}) debug(error) + if (!captureErrors && error.oclif?.exit !== undefined) throw error } } })