mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-26 01:12:21 +00:00
test(ui): clean up synchronous browser failures
This commit is contained in:
parent
0dc2f0b1c1
commit
a8ab1187ca
1 changed files with 6 additions and 4 deletions
|
|
@ -37,10 +37,12 @@ export async function runWithCleanup(
|
|||
action: () => Promise<void>,
|
||||
cleanup: () => Promise<boolean>,
|
||||
): Promise<void> {
|
||||
const outcome = await action().then(
|
||||
() => ({ status: "success" as const }),
|
||||
(error: unknown) => ({ status: "failure" as const, error }),
|
||||
);
|
||||
const outcome = await Promise.resolve()
|
||||
.then(action)
|
||||
.then(
|
||||
() => ({ status: "success" as const }),
|
||||
(error: unknown) => ({ status: "failure" as const, error }),
|
||||
);
|
||||
try {
|
||||
if (outcome.status === "failure") throw outcome.error;
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue