Giter Club home page Giter Club logo

Comments (3)

JOU-amjs avatar JOU-amjs commented on June 3, 2024

感谢反馈。
我刚尝试了复现问题,但一切都是正常的,然后又翻看了下源码和测试用例,也是正常的。也就是接口报错的话,不会开始倒计时,也可以正常触发onError

我猜可能是你所说的报错,应该是接口正常响应了,但返回了例如code: 500这样的数据,但这里的onError在以下两个情况才会触发:

  1. 接口请求不通或超时导致的直接报错。
  2. 前端在全局拦截器、或method实例的transformData里抛出一个错误

你可以按以上情况检查下,如果还是没有解决,可以贴一下全局拦截器、method实例的、useCaptcha部分的代码,再贴下网络请求的截图,再进一步分析。也可以加qq频道直接沟通,#210

from alova.

cleveng avatar cleveng commented on June 3, 2024

400 - 499 状态码 是否会触发 onError 事件, 我接口请求,返回404状态码都是进入了 onSuccess。 这不合理。

from alova.

JOU-amjs avatar JOU-amjs commented on June 3, 2024

@cleveng 这是由请求适配器决定的,如果你用的是GloblFetch,内部的fetch函数只会在请求超时或网络中断时抛出错误,如果访问到了服务器,无论返回的status是什么,都会认为是请求成功了,这是fetch函数的特性。

你可以在onSuccess中自行判断并主动抛出错误,这样useCaptcha的onError也会被触发

from alova.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.