I got a issue with es6 async/await while working on below code. The problem is if there is any error occurred during saving it is not throwing any error (like i have validation on password and using try/catch), So do i need to use promise then/catch or is there any way with this?
var newUser = new User({
firstname : f_name,
lastname : l_name,
password : "dsadasdas",
social:{social_id : social_id,
via : via},
email : mail,
ref_id : ref_id,
verification_code : verification_code,
role :"USER",
loc: {type: "Point", coordinates: [0, 0]},
provider: 'local',
});
const data = await newUser.save()
via Charanjeet Singh
No comments:
Post a Comment