mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
chore: display error message from response when tool repository login fails (#4075)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import base64
|
import base64
|
||||||
|
from json import JSONDecodeError
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -162,9 +163,19 @@ class ToolCommand(BaseCommand, PlusAPIMixin):
|
|||||||
|
|
||||||
if login_response.status_code != 200:
|
if login_response.status_code != 200:
|
||||||
console.print(
|
console.print(
|
||||||
"Authentication failed. Verify if the currently active organization access to the tool repository, and run 'crewai login' again. ",
|
"Authentication failed. Verify if the currently active organization can access the tool repository, and run 'crewai login' again.",
|
||||||
style="bold red",
|
style="bold red",
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
|
console.print(
|
||||||
|
f"[{login_response.status_code} error - {login_response.json().get('message', 'Unknown error')}]",
|
||||||
|
style="bold red italic",
|
||||||
|
)
|
||||||
|
except JSONDecodeError:
|
||||||
|
console.print(
|
||||||
|
f"[{login_response.status_code} error - Unknown error - Invalid JSON response]",
|
||||||
|
style="bold red italic",
|
||||||
|
)
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
login_response_json = login_response.json()
|
login_response_json = login_response.json()
|
||||||
|
|||||||
Reference in New Issue
Block a user