Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve cli error-handling #798

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

inimaz
Copy link
Contributor

@inimaz inimaz commented Mar 11, 2025

Some minor tweaks to the cli to handle better the errors

@inimaz inimaz requested review from prmths128 and LuisBlanche March 11, 2025 09:18
Copy link
Collaborator

@SaboniAmine SaboniAmine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Inigo!

@@ -223,6 +228,9 @@ def config():
description=org_description,
)
organization = api.create_organization(organization=organization_create)
if organization is None:
print("Error creating organization")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get a functional error returned to the user, from the create_organization method ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Issue is in the api_client we are hiding all the errors (maybe this is intended?) see --> https://github.com/mlco2/codecarbon/blob/master/codecarbon/core/api_client.py#L137

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was made to avoir showing some technical errors to the user, which could bring confusion.
We might have more functional errors, wrapping the technical ones to give hints to the user on how to fix the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants