I’m using custom database connections with “Change Password” database action script like this:
function changePassword(email, newPassword, callback) {
// initialize my client ...
someClient.changePassword(someParams)
.then((res) => {
// success!
callback(null, true);
})
.catch((e) => {
// failed!
callback(new Error("Something wrong!"));
});
}
When the password change fails for some reason (ex: too weak password), we want to show the custom error message “Something wrong!”, but got “There was an error processing the password reset.” instead.
How can we achieve this?