Skip to content

Appropriate Token error #290

Open
Sundraiz-Shah wants to merge 4 commits into
masterfrom
240-Appropriate-token-error
Open

Appropriate Token error #290
Sundraiz-Shah wants to merge 4 commits into
masterfrom
240-Appropriate-token-error

Conversation

@Sundraiz-Shah

@Sundraiz-Shah Sundraiz-Shah commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

What changed

Before this fix, when something went wrong (wrong token, expired token, wrong URL), the tool would silently fail with a generic or confusing message. Now it tells you exactly what the problem is.

Situation Before After
Wrong GitHub token "nothing harvested" (no reason given) "The provided GitHub token is invalid"
Expired GitHub token "nothing harvested" (no reason given) "The GitHub token has expired"
Wrong GitHub URL "nothing harvested" (no reason given) "GitHub repository not found"
Wrong GitLab token "GitLab requires a valid personal access token" "The provided GitLab token is invalid"
Expired GitLab token "GitLab requires a valid personal access token" "The GitLab token has expired"
Wrong GitLab URL "GitLab requires a valid personal access token" "GitLab repository not found"

In short: instead of a confusing dead end, you now get a clear message telling you what went wrong and where.

Issue #240 Appropriate error when token is expired (Solved)
Issue #209 Differentiate error between URL and token (Solved)

@Sundraiz-Shah Sundraiz-Shah force-pushed the 240-Appropriate-token-error branch from e4e1c8e to 5ff617f Compare June 11, 2026 10:50

@Aidajafarbigloo Aidajafarbigloo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the changes. There are still cases where the system does not display an appropriate error message to the user. Please address this and ensure error handling is consistent across various relevant scenarios, and validate the fix across multiple repositories to cover different cases and conditions.

headers = {"PRIVATE-TOKEN": token}
response = requests.get(api_url, headers=headers)
return response.status_code == 200
return {"status": "invalid_url", "message": "Invalid GitLab repository URL format."}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

returns also for gh repos

pass
return {
"status": "invalid_token",
"message": "The provided GitLab token is invalid. Please check your token and try again.",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Instead I received "Unexpected response from GitLab API (HTTP 400)."

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.

Appropriate error when token is expired Differentiate error between URL and token

2 participants