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

Use more friendly error message when a repository can not be accessed #18225

Closed
wxiaoguang opened this issue Jan 10, 2022 · 1 comment · Fixed by #18288
Closed

Use more friendly error message when a repository can not be accessed #18225

wxiaoguang opened this issue Jan 10, 2022 · 1 comment · Fixed by #18288
Labels
type/enhancement An improvement of existing functionality
Milestone

Comments

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jan 10, 2022

Now, if users access an invalid repository (non-existing, renamed, etc), they would see:

$ git fetch
Gitea: Internal Server Error
Gitea: Internal Server Error
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The Internal Server Error is quite misleading and there is a error level message in Gitea log:

...ters/private/serv.go:114:ServCommand() [E] Unable to get repository owner: org-name/repo-name Error: user does not exist [uid: 0, name: org-name, keyid: 0]

Since such case is not an serious error, users should not see the Internal Server Error or the error level log messages.

@lunny
Copy link
Member

lunny commented Jan 10, 2022

We should say the repository is not exist or you have no access to this repository.

@lunny lunny added the type/enhancement An improvement of existing functionality label Jan 10, 2022
zeripath added a commit to zeripath/gitea that referenced this issue Jan 15, 2022
Gitea serv will currently return an 500 if we try to pull from a repository where
the owner does not exist.

This PR checks for the UserNotExist Error when checking for the user and will
return a NotFound error instead.

Fix go-gitea#18225

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added this to the 1.16.0 milestone Jan 15, 2022
wxiaoguang pushed a commit that referenced this issue Jan 16, 2022
* Return nicer error if trying to pull from non-existent user

Gitea serv will currently return an 500 if we try to pull from a repository where
the owner does not exist.

This PR checks for the UserNotExist Error when checking for the user and will
return a NotFound error instead.

Fix #18225
Chianina pushed a commit to Chianina/gitea that referenced this issue Mar 28, 2022
…#18288)

* Return nicer error if trying to pull from non-existent user

Gitea serv will currently return an 500 if we try to pull from a repository where
the owner does not exist.

This PR checks for the UserNotExist Error when checking for the user and will
return a NotFound error instead.

Fix go-gitea#18225
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants