How to restrict sign ups for certain users

Not sure if this is helpful or not (I’m not a developer) but I had a look at the hook we are using. If the hook finds the new user is trying to use a username already taken by a user in our legacy system (LDAP directory) we are sending an Error back like so:

        } else {
          console.log("Username already taken.");
          return callback(new Error("Please select a different username."));
        }

We are using Lock as well. Now I am curious to see how this actually manifests in the Lock UI. I’ll try testing it to see if it shows anything useful.