chore: display error message from response when tool repository login fails (#4075)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Notify Downstream / notify-downstream (push) Has been cancelled

This commit is contained in:
Heitor Carvalho
2025-12-11 14:56:00 -03:00
committed by GitHub
parent feec6b440e
commit 0632a054ca

View File

@@ -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()