Threw and caught ConnectException to registerUser function.