From 92e6443cf046bcbcb6e999340932356e87d9d39d Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Wed, 28 Aug 2019 22:47:37 -0400 Subject: [PATCH] End group in core.group regardless of error thrown --- packages/core/src/core.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index baa028bc..d98e4d7c 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -159,7 +159,14 @@ export function endGroup(): void { */ export async function group(name: string, fn: () => Promise): Promise { startGroup(name) - const result = await fn() - endGroup() + + let result: T + + try { + result = await fn() + } finally { + endGroup() + } + return result }