Comments (3)
感谢反馈。
我刚尝试了复现问题,但一切都是正常的,然后又翻看了下源码和测试用例,也是正常的。也就是接口报错的话,不会开始倒计时,也可以正常触发onError
。
我猜可能是你所说的报错,应该是接口正常响应了,但返回了例如code: 500这样的数据,但这里的onError
在以下两个情况才会触发:
- 接口请求不通或超时导致的直接报错。
- 前端在全局拦截器、或method实例的
transformData
里抛出一个错误
你可以按以上情况检查下,如果还是没有解决,可以贴一下全局拦截器、method实例的、useCaptcha部分的代码,再贴下网络请求的截图,再进一步分析。也可以加qq频道直接沟通,#210
from alova.
400 - 499 状态码 是否会触发 onError 事件, 我接口请求,返回404状态码都是进入了 onSuccess。 这不合理。
from alova.
@cleveng 这是由请求适配器决定的,如果你用的是GloblFetch,内部的fetch函数只会在请求超时或网络中断时抛出错误,如果访问到了服务器,无论返回的status是什么,都会认为是请求成功了,这是fetch函数的特性。
你可以在onSuccess中自行判断并主动抛出错误,这样useCaptcha的onError也会被触发
from alova.
Related Issues (20)
- 在 useRequest 中如果请求未发出,调用 abort() 会导致报错 HOT 1
- Typescript error HOT 4
- 期望createAlova能增加对全局默认meta的配置 HOT 5
- unibest(uni-app) 接入 alova 报错。 HOT 4
- 服务端内存泄漏问题 HOT 4
- useWatcher + useFetcher 命中缓存的情况下,数据混乱的问题 HOT 4
- The automated release is failing 🚨
- unibest 接入 alova 类型提示怎么处理 HOT 1
- 尝试并发请求,使用alova实例或者通过useRequest进行请求,出现了实际请求丢失,但是有响应的情况,直接使用axios来请求没有问题 HOT 2
- 使用download进度下载,abort后出现报错 HOT 1
- ReferenceError: Cannot access 'noop' before initialization HOT 1
- 设置全局responded拦截器onSuccess后请求不会命中缓存 HOT 4
- Upload progress not working in 2.20.0 HOT 7
- 使用Mock的时候直接报 TypeError: Cannot read properties of undefined (reading 'toString') HOT 6
- 按照文档typescript项目引入,在没有导入alova,是类型推断会标红 HOT 3
- react项目中使用了alova导致jest执行单测报错 HOT 12
- Taro开发环境,占位缓存模式,不会自动发送新请求。 HOT 8
- 暴露instance 实例适用于动态更改MethodType HOT 1
- Get请求时 传键值对无法解析 HOT 7
- useRequest发送请求如何不使用缓存模式 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alova.