[英]Unhandled promise rejection - Firefox
我不斷遇到這個錯誤,但我不確定它在生氣什么。 我正在使用最新版本的FF,並且此代碼可在最新版本的Chrome甚至Ie 11中使用。
Unhandled promise rejection
Error: Network Error
Stack trace:
createError@http://localhost:8080/main.js:6075:15
handleError@http://localhost:8080/main.js:5618:14
columnNumber: 15
config: Object { timeout: 5000, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", … }
fileName: "http://localhost:8080/main.js"
lineNumber: 6075
message: "Network Error"
request: XMLHttpRequest { readyState: 4, timeout: 5000, withCredentials: false, … }
response: undefined
stack: "createError@http://localhost:8080/main.js:6075:15\nhandleError@http://localhost:8080/main.js:5618:14\n"
__proto__: Object { … }
onUnhandled/</result<
es6.promise.js:101
./node_modules/babel-polyfill/node_modules/core-js/modules/_perform.js/module.exports
_perform.js:3:12
onUnhandled/<
es6.promise.js:95
./node_modules/babel-polyfill/node_modules/core-js/modules/_invoke.js/module.exports
_invoke.js:5
<anonymous>
_task.js:35
run
_task.js:21
listener
_task.js:25
這是它垂死的代碼
login: flow(function*(email, password) {
console.log("login")
try {
const response = yield self.rootStore().axios.post(
"/tokens/auth", {
email: email,
password: password,
grantType: "password",
}
);
return response;
}
catch(e){
console.log(e, "catch")
}
}),
似乎即使它們是一個錯誤,它仍然會呼叫我“然后”,這會引起問題(盡管仍然是為什么所有其他瀏覽器都可以通過時出現網絡錯誤的根本問題)
login(values.email, values.password).then((response) => {
console.log("response", response); // this get called. Eventhough in the login flow function the error gets caught.
}).catch(e => {console.log(e)})
看起來您正在使用生成器函數。 希望這與問題無關。 你yield
荷蘭國際集團的承諾了,而不是await
第一荷蘭國際集團呢?
您是否嘗試過添加.catch(e => { console.log(e); })
或其他東西來查看拒絕是什么?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.