Prevent contact duplicates in custom registration?

Thanks for the help, Majd and Mustafa. The detection works, but I just need help with showing an error message. I believe it might just be the brackets.

Here is what I have. It says I have an error on the last line.

let user = wixUsers.currentUser;

user.getEmail()
.then( (email) => {
let userEmail = email; // "user@something.com"

wixData.query('contactInfo')
.eq('#email', userEmail)
.find()
.then((res) => {
if(res) {
return console.log('Duplicate user found, returning');
//add error message to show or redirect here
if ('Duplicate user found, returning') {
$w('#error').show();
$w('#errorText').show();
}

//insert to collection here (no duplicate found)
}
} 
);