Check if the user has used social login in Custom DB script

If a user has signed up using Social login and tries to use the email/pw approach, Auth0 executes login scripts and returns the 401 error message. I am trying to find a way where can notify the user to use social login by returning a user-friendly error message instead of throwing a 401 error message. Is there a way to check if the email belongs to a user using management API and check the entities list for social sources in the login script?