Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NameError in ClientApplication exception handler #363

Merged
merged 1 commit into from
May 19, 2021

Conversation

chlowell
Copy link
Contributor

To reproduce the error:

from msal import PublicClientApplication

class Client:
    def get(*args, **kwargs):
        raise Exception('oops')

PublicClientApplication('...', http_client=Client())
Traceback (most recent call last):
  File "repro.py", line 8, in <module>
    PublicClientApplication("...", http_client=Client())
  File "...lib\site-packages\msal\application.py", line 1296, in __init__
    super(PublicClientApplication, self).__init__(
  File "...lib\site-packages\msal\application.py", line 302, in __init__
    if validate_authority and region:
NameError: name 'region' is not defined

I assume the keyword argument azure_region is intended.

@@ -299,7 +299,7 @@ def __init__(
except ValueError: # Those are explicit authority validation errors
raise
except Exception: # The rest are typically connection errors
if validate_authority and region:
if validate_authority and azure_region:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, our last-minute change from region to azure_region left this one behind. My bad.

Nice catch! Thanks!

@rayluo rayluo merged commit 15c3474 into AzureAD:dev May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants