Skip to content

Commit d987838

Browse files
Login method error return
1 parent 5f0fc09 commit d987838

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/codeflare_sdk/cluster/auth.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,8 @@ def login(self) -> str:
119119
client.AuthenticationApi(api_client).get_api_group()
120120
config_path = None
121121
return "Logged into %s" % self.server
122-
except client.ApiException: # pragma: no cover
123-
api_client = None
124-
print("Authentication Error please provide the correct token + server")
122+
except client.ApiException as e:
123+
_kube_api_error_handling(e)
125124

126125
def logout(self) -> str:
127126
"""

src/codeflare_sdk/utils/kube_api_helpers.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ def _kube_api_error_handling(
4343
print(nf_msg)
4444
return
4545
elif e.reason == "Unauthorized" or e.reason == "Forbidden":
46-
raise PermissionError(perm_msg)
46+
if print_error:
47+
print(perm_msg)
48+
return
4749
elif e.reason == "Conflict":
4850
raise FileExistsError(exists_msg)
4951
raise e

0 commit comments

Comments
 (0)