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

More specific error message when github auth fails #238

Merged

Conversation

teodorlu
Copy link
Contributor

@teodorlu teodorlu commented Aug 4, 2024

Please answer the following questions and leave the below in as part of your PR.

Proposed solution

Invalid Github token error messages before this PR:

$ neil dep upgrade
{"message":"Bad credentials","documentation_url":"https://docs.github.com/rest","status":"401"}
{"message":"Bad credentials","documentation_url":"https://docs.github.com/rest","status":"401"}

Invalid Github token error messages after this PR:

$ neil-dev dep upgrade
Your neil github token is invalid or expired.
Please double check your  NEIL_GITHUB_TOKEN  environment variable.
See neil's README for more details.
Your neil github token is invalid or expired.
Please double check your  NEIL_GITHUB_TOKEN  environment variable.
See neil's README for more details.

Other changes

  • Behavior outside of error messages is left unchanged
  • I pulled the environment variables for Github tokens (eg NEIL_GITHUB_TOKEN) into a def in order to provide more specific error messages

Error message formatting

Other error messages are printed with the first line not indented, and following lines indented:

You've hit the github rate-limit (60 reqs/hr).
  You can set an API Token to increase the limit.
  See neil's README for details.

I'm not sure whether this is the desired way to print errors, or if it's accidental, eg code indenting. Clarification welcome!

@teodorlu teodorlu marked this pull request as ready for review August 4, 2024 13:36
@borkdude borkdude merged commit 6728367 into babashka:main Aug 4, 2024
4 checks passed
@borkdude
Copy link
Contributor

borkdude commented Aug 4, 2024

Thanks!

@teodorlu teodorlu deleted the github-http-request-better-error-messages branch August 4, 2024 15:33
@teodorlu teodorlu changed the title More specific message when github auth fails More specific error message when github auth fails Aug 4, 2024
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