Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何判断error对象是 umi-request 抛出来的呢?有类似isAxiosError的函数么? #307

Open
huyaocode opened this issue Jul 28, 2022 · 0 comments

Comments

@huyaocode
Copy link

如下代码,请求可能抛错,逻辑也可能抛错。如何判断这个 error 对象是否为 umi-request 抛出来?

如果是 axios 的话可以用 axios.isAxiosError,umi-request 呢?

try {
    const data = await fetchData(); // 使用  umi-request 打请求
    handleData(data); 
} catch (error) {
   //  如何判断这个 error 对象是 `umi-request` 抛出来的?
}
@huyaocode huyaocode changed the title 如何判断error对象是 umi-request 抛出来的呢?有什么特征么? 如何判断error对象是 umi-request 抛出来的呢?有类似isAxiosError的函数么? Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant