Skip to content

Commit

Permalink
refactor(useLockFn): catch to finally (alibaba#2421)
Browse files Browse the repository at this point in the history
* refactor(useLockFn): catch to finally

* refactor(useLockFn): keep the throw e
  • Loading branch information
coding-ice authored and raotaohub committed Mar 28, 2024
1 parent e1cc2c9 commit 9db994f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/hooks/src/useLockFn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ function useLockFn<P extends any[] = any[], V = any>(fn: (...args: P) => Promise
lockRef.current = true;
try {
const ret = await fn(...args);
lockRef.current = false;
return ret;
} catch (e) {
lockRef.current = false;
throw e;
} finally {
lockRef.current = false;
}
},
[fn],
Expand Down

0 comments on commit 9db994f

Please sign in to comment.