diff --git a/superset/db_engine_specs/base.py b/superset/db_engine_specs/base.py index 6a596965b7f..4d26ca8517a 100644 --- a/superset/db_engine_specs/base.py +++ b/superset/db_engine_specs/base.py @@ -590,7 +590,9 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods # Driver-specific params to be included in the `get_oauth2_token` request body oauth2_additional_token_request_params: dict[str, Any] = {} # Driver-specific exception that should be mapped to OAuth2RedirectError - oauth2_exception = OAuth2RedirectError + oauth2_exception: type[Exception] | tuple[type[Exception], ...] = ( + OAuth2RedirectError + ) # Does the query id related to the connection? # The default value is True, which means that the query id is determined when diff --git a/superset/db_engine_specs/gsheets.py b/superset/db_engine_specs/gsheets.py index d184d05341b..5eda47e8e6a 100644 --- a/superset/db_engine_specs/gsheets.py +++ b/superset/db_engine_specs/gsheets.py @@ -41,7 +41,7 @@ from superset.databases.schemas import encrypted_field_properties, EncryptedStri from superset.db_engine_specs.base import DatabaseCategory from superset.db_engine_specs.shillelagh import ShillelaghEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType -from superset.exceptions import SupersetException +from superset.exceptions import OAuth2TokenRefreshError, SupersetException from superset.utils import json from superset.utils.oauth2 import get_oauth2_access_token @@ -152,7 +152,7 @@ class GSheetsEngineSpec(ShillelaghEngineSpec): "https://accounts.google.com/o/oauth2/v2/auth" ) oauth2_token_request_uri = "https://oauth2.googleapis.com/token" # noqa: S105 - oauth2_exception = UnauthenticatedError + oauth2_exception = (UnauthenticatedError, OAuth2TokenRefreshError) @classmethod def get_oauth2_authorization_uri(