From c54b54f175564acf0c0fff69035611a90bef7ee5 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 --- src/core.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core.ts b/src/core.ts index baa028b..d98e4d7 100644 --- a/src/core.ts +++ b/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 }