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

check for message attribute #81

Merged
merged 3 commits into from
Dec 12, 2023
Merged

Conversation

neelasha23
Copy link
Contributor

@neelasha23 neelasha23 commented Dec 9, 2023

Describe your changes

Added check for message attribute when displaying Slack link. This is required for exceptions which have message as their first parameter and not args.

Issue number

Closes #X

Checklist before requesting a review


📚 Documentation preview 📚: https://ploomber-core--81.org.readthedocs.build/en/81/

@edublancas
Copy link
Contributor

@neelasha23 I'm guessing this is because of: https://github.com/ploomber/cli/issues/7 ?

is it because ClickException has message? https://github.com/ploomber/cli/blob/main/src/ploomber_cloud/exceptions.py

@neelasha23
Copy link
Contributor Author

neelasha23 commented Dec 10, 2023

@neelasha23 I'm guessing this is because of: ploomber/cli#7 ?

yes

is it because ClickException has message? https://github.com/ploomber/cli/blob/main/src/ploomber_cloud/exceptions.py

Yes it doesn't seem to be accessing the args attribute while displaying the error. It has the message attribute : https://click.palletsprojects.com/en/7.x/api/#click.ClickException. Setting this is enabling the community link display

have created a test PR in JupySQL to ensure the change doesn't affect the JupySQL tests.
tests are passing: https://github.com/ploomber/jupysql/actions/runs/7159358411

@edublancas

@neelasha23 neelasha23 marked this pull request as ready for review December 11, 2023 15:42
@neelasha23
Copy link
Contributor Author

@edublancas Ready for review.

@@ -87,6 +87,8 @@ def _add_community_link(e):
elif COMMUNITY not in e.args[0]:
message = e.args[0] + COMMUNITY
e.args = (message,)
if hasattr(e, "message"):
Copy link
Contributor

Choose a reason for hiding this comment

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

just add a short comment explaining why we have this edge case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@edublancas edublancas merged commit 2066d88 into ploomber:main Dec 12, 2023
18 checks passed
@edublancas
Copy link
Contributor

I've released this in 0.2.19: 538e7e7

should be on PyPI in a few minutes, please update your other PR and pin ploomber-core>=0.2.19 with a note explaining that we need this version bc of this change

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