Closed
Description
Describe the bug
throw an error in onBefore
,
onError
callback is not fire...
Steps to reproduce
<template>
<button @click="run">run</button>
<div>data: {{ JSON.stringify(data) }}</div>
<div>error: {{ error?.message }}</div>
</template>
<script setup>
import { useRequest } from 'vue-hooks-plus';
const { data, error, run } = useRequest(async () => {
// return anything here
}, {
manual: true,
onBefore() {
// do something then
throw new Error('example'); // remove this line everything will fine
},
onSuccess(result) {
console.log('okay:', result)
},
onError(error) {
console.error('inner', error); // this line will not run, can't catch `Error: example`
},
});
</script>
System Info
vue-hooks-plus: 1.8.6
vue: 3.3.x
Used Package Manager
npm
Validations
- Follow our Code of Conduct.
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a VueHooks Plus issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.