Skip to content

Commit 0632a05

Browse files
authored
chore: display error message from response when tool repository login fails (#4075)
1 parent feec6b4 commit 0632a05

File tree

1 file changed

+12
-1
lines changed
  • lib/crewai/src/crewai/cli/tools

1 file changed

+12
-1
lines changed

lib/crewai/src/crewai/cli/tools/main.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import base64
2+
from json import JSONDecodeError
23
import os
34
from pathlib import Path
45
import subprocess
@@ -162,9 +163,19 @@ def login(self) -> None:
162163

163164
if login_response.status_code != 200:
164165
console.print(
165-
"Authentication failed. Verify if the currently active organization access to the tool repository, and run 'crewai login' again. ",
166+
"Authentication failed. Verify if the currently active organization can access the tool repository, and run 'crewai login' again.",
166167
style="bold red",
167168
)
169+
try:
170+
console.print(
171+
f"[{login_response.status_code} error - {login_response.json().get('message', 'Unknown error')}]",
172+
style="bold red italic",
173+
)
174+
except JSONDecodeError:
175+
console.print(
176+
f"[{login_response.status_code} error - Unknown error - Invalid JSON response]",
177+
style="bold red italic",
178+
)
168179
raise SystemExit
169180

170181
login_response_json = login_response.json()

0 commit comments

Comments
 (0)