在组件里面调用dispatch,返回的promise未能catch异常
背景
在action中call一个api,api报错,这个错误在组件的dispatch中捕获不到。
浏览器报错
uncaught at _callee3 at _callee3
at _callee6
at takeEvery(tagEditModel/addCategory, _callee)
at _callee
at _callee
Error: Error: 错误测试
at addCategory$ (http://localhost:8000/umi.js:93924:21)
at tryCatch (http://localhost:8000/umi.js:77209:40)
at Generator.invoke [as _invoke] (http://localhost:8000/umi.js:77435:22)
at Generator.prototype.(anonymous function) [as next] (http://localhost:8000/umi.js:77261:21)
at next (http://localhost:8000/umi.js:75226:27)
at proc (http://localhost:8000/umi.js:75185:3)
at resolveIterator (http://localhost:8000/umi.js:75371:5)
at runEffect (http://localhost:8000/umi.js:75347:178)
at next (http://localhost:8000/umi.js:75230:9)
at currCb (http://localhost:8000/umi.js:75303:7)
at http://localhost:8000/umi.js:75414:16
at exec (http://localhost:8000/umi.js:76081:5)
at flush (http://localhost:8000/umi.js:76122:5)
at asap (http://localhost:8000/umi.js:76095:5)
at Array.<anonymous> (http://localhost:8000/umi.js:74456:27)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
dva config里要注册onError方法,否则错误不上抛