How to return an error in custom hubspot.create.form script
I'm using the following code in hbspt.forms.create to validate the presence of user in the database before adding him to the target website and hubspot database. If the user is already present in the database of target website, then HS script should not get executed further and return an error i.e., user already present. If the user is a new user, based on the validation below, he would be added to the HS database of the client. I'm not sure how to return an error to the calling function so that the HS script stops executing and returns an error to the user. With the script below, the user gets added to HS when the custom script returns false. This should not happen. Any suggestion and improvements to the code below would be appreciated.