Skip to content

Commit

Permalink
feat(useAsyncFn): support onError callback
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiboss committed Aug 5, 2024
1 parent 9071e38 commit 072f0cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/use-async-fn/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export type UseAsyncFnOptions = {
* @defaultValue false
*/
clearBeforeRun?: boolean
/**
* a function to run when the async function throws an error
*
* @defaultValue undefined
*/
onError?: (error: unknown) => void
}
```
Expand Down
6 changes: 6 additions & 0 deletions src/use-async-fn/index_zh-cn.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export type UseAsyncFnOptions = {
* @defaultValue false
*/
clearBeforeRun?: boolean
/**
* 异步函数抛出错误时的回调函数
*
* @defaultValue undefined
*/
onError?: (error: unknown) => void
}
```
Expand Down

0 comments on commit 072f0cf

Please sign in to comment.