diff --git a/python/delta_sharing/protocol.py b/python/delta_sharing/protocol.py index 9dbebd327..49ca13736 100644 --- a/python/delta_sharing/protocol.py +++ b/python/delta_sharing/protocol.py @@ -74,7 +74,7 @@ def from_json(json) -> "DeltaSharingProfile": bearer_token = json["bearerToken"], expiration_time = json.get("expirationTime"), ) - else: + elif share_credentials_version == 2: type = json["type"] if type == "persistent_oauth2.0": token_endpoint = json["token_endpoint"] @@ -108,7 +108,15 @@ def from_json(json) -> "DeltaSharingProfile": raise ValueError( "The current release does not supports {type} type. " "Please check type." - ) + ) + else: + raise ValueError( + "'shareCredentialsVersion' in the profile is " + f"{share_credentials_version} which is too new. " + f"The current release supports version {DeltaSharingProfile.CURRENT} and below. " + "Please upgrade to a newer release." + ) + @dataclass(frozen=True)