问题标签 [unhandled-promise-rejection]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - 是否可以在异步 Javascript 代码中“防弹”try..catch?
最近我在调试一段异步 NodeJS 代码时遇到了非常令人沮丧的事情:我认为肯定会被捕获的异常try..catch
正在泄漏,导致async_foo
函数外部出现未处理的 promise 错误。
从那以后,我了解到,由于 async..await 是如何通过 Promises 实现的,因此在 async JS 中有许多种方法可以让自己陷入困境,但仍然:
无论嵌套异步代码是如何实现的,是否有可能以绝对绝对始终处理嵌套异步代码错误的方式编写您的异步 JS 代码?基于库的解决方案很重要。
react-native - 可能未处理的承诺拒绝(id:0)
我已经有这个问题一个多月了,每当我尝试使用移动设备登录我的 react-native 应用程序时就会出现这个错误。
这是错误
这是登录我的反应本机应用程序的代码