Answer the question
In order to leave comments, you need to log in
How to forward the error down?
Please tell me how to forward your error down.
export const logIn = (email, password, displayName) => {
return async (dispatch) => {
try {
let db = firebase.firestore();
const settings = { timestampsInSnapshots: true };
db.settings(settings);
let NameRef = db.collection("Users").doc(displayName);
let Name = await NameRef.get();
if(Name.exists){
throw new Error("Имя");
}else{
await firebase.auth().createUserWithEmailAndPassword(email, password);
let User = await firebase.auth().currentUser;
await User.updateProfile({ displayName: displayName });
let Uid = { uid: User.uid };
dispatch(writesUser(User));
await axios.post('/api/emailVerified', Uid);
}
} catch (e) {
throw e;
}
};
}
Answer the question
In order to leave comments, you need to log in
Type entry:
try {
throw new Error('Ooops!');
} catch (e) {
throw e;
}
try {
throw new Error('Ooops!');
} catch (e) {
alert(e); // например, выводим ошибку в alert
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question