From f98afac6df7719da3cb5fe82c3b6183316f6618f Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Tue, 28 Apr 2015 07:05:49 -0400 Subject: [PATCH] if you make an API call with a user-specific API key (e.g. from control panel) but your account no longer exists on the system, there was an unhandled error see 1039a08be6d0b811df18c946c57afb445868b971 --- management/auth.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/management/auth.py b/management/auth.py index 1ae46d1e..04e605c3 100644 --- a/management/auth.py +++ b/management/auth.py @@ -111,12 +111,12 @@ class KeyAuthService: # Login failed. raise ValueError("Invalid password.") - # Get privileges for authorization. - - # (This call should never fail on a valid user. But if it did fail, it would - # return a tuple of an error message and an HTTP status code.) + # Get privileges for authorization. This call should never fail on a valid user, + # but if the caller passed a user-specific API key then the user may no longer + # exist --- in that case, get_mail_user_privileges will return a tuple of an + # error message and an HTTP status code. privs = get_mail_user_privileges(email, env) - if isinstance(privs, tuple): raise Exception("Error getting privileges.") + if isinstance(privs, tuple): raise ValueError(privs[0]) # Return a list of privileges. return privs