1
0
Fork 0

End group in core.group regardless of error thrown

pull/98/head
Jonathan Clem 2019-08-28 22:47:37 -04:00
parent 8f9992ca17
commit 92e6443cf0
No known key found for this signature in database
GPG Key ID: 48C5B22E9FD6E80F
1 changed files with 9 additions and 2 deletions

View File

@ -159,7 +159,14 @@ export function endGroup(): void {
*/ */
export async function group<T>(name: string, fn: () => Promise<T>): Promise<T> { export async function group<T>(name: string, fn: () => Promise<T>): Promise<T> {
startGroup(name) startGroup(name)
const result = await fn()
let result: T
try {
result = await fn()
} finally {
endGroup() endGroup()
}
return result return result
} }