Merge pull request #541 from taylorwilsdon/issues/511
fix: only suggest re-authentication for auth-related HTTP errors
This commit is contained in:
@@ -25,7 +25,11 @@ LIST_TASKS_MAX_POSITION = "99999999999999999999"
|
|||||||
|
|
||||||
|
|
||||||
def _format_reauth_message(error: Exception, user_google_email: str) -> str:
|
def _format_reauth_message(error: Exception, user_google_email: str) -> str:
|
||||||
base = f"API error: {error}. You might need to re-authenticate."
|
base = f"API error: {error}"
|
||||||
|
|
||||||
|
# Only suggest re-authentication for auth-related errors (401, 403)
|
||||||
|
if isinstance(error, HttpError) and error.resp.status in (401, 403):
|
||||||
|
base += ". You might need to re-authenticate."
|
||||||
if is_oauth21_enabled():
|
if is_oauth21_enabled():
|
||||||
if is_external_oauth21_provider():
|
if is_external_oauth21_provider():
|
||||||
hint = (
|
hint = (
|
||||||
@@ -44,6 +48,8 @@ def _format_reauth_message(error: Exception, user_google_email: str) -> str:
|
|||||||
)
|
)
|
||||||
return f"{base} {hint}"
|
return f"{base} {hint}"
|
||||||
|
|
||||||
|
return base
|
||||||
|
|
||||||
|
|
||||||
class StructuredTask:
|
class StructuredTask:
|
||||||
def __init__(self, task: Dict[str, str], is_placeholder_parent: bool) -> None:
|
def __init__(self, task: Dict[str, str], is_placeholder_parent: bool) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user