0
我在我的傳奇中調用了firebase函數。該功能正常工作,如果錯誤返回,它來到傳奇的catch塊。但是錯誤變量沒有通過。下面的代碼:如何將承諾中的錯誤返回到REDX傳奇catch塊?現在得到錯誤undefined
const firebaseAuth = ({ email, password }) =>
firebase.auth().signInWithEmailAndPassword(email, password)
.catch((error) => { throw error; });
function* loginUser(action) {
try {
const user = yield call(firebaseAuth, action.payload);
yield put({ type: USER_LOGIN_SUCCESS, payload: { user } });
} catch (error) {
/* eslint-disable no-debugger */
debugger;
// I need to see the error here.
yield put({ type: USER_LOGIN_FAIL });
}
}
function* sessionSaga() {
yield takeEvery(USER_LOGGING_IN, loginUser);
}
export default sessionSaga;
目前,當在debugger
聲明的程序中斷,錯誤是不確定的。任何想法如何解決這個問題?
你試圖把調試到承諾捕捉功能? '.catch((error)=> {debugger; throw error;});'...那裏的錯誤變量是不確定的嗎? –