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

Improve error feedback for duplicate deploy keys #13112

Merged
merged 3 commits into from
Oct 12, 2020

Conversation

chrisshyi
Copy link
Contributor

Instead of a generic HTTP 500 error page, a flash message is rendered with the deploy key page template to inform the user that a key with the intended title already exists. Resolves #13110

Instead of a generic HTTP 500 error page, a flash message is rendered
with the deploy key page template so inform the user that a key with the
intended title already exists.
@zeripath
Copy link
Contributor

Hi thanks for the PR!

Could you add handling to routers/api/v1/repo/key.go:172-183:func HandleAddKeyError(ctx *context.APIContext, err error) { too?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 12, 2020
Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

👍

@zeripath
Copy link
Contributor

also I suspect that we need to "handle" more of the "expected" errors in models/user.go:1751-1772:func addLdapSSHPublicKeys(usr *User, s *LoginSource, sshPublicKeys []string) bool { but that could be a different PR. (Mostly switching them to log.Trace(...) instead of log.Error(...)

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 12, 2020
@6543 6543 added the type/enhancement An improvement of existing functionality label Oct 12, 2020
@6543
Copy link
Member

6543 commented Oct 12, 2020

I'm fine with as is and yes it's true there could be handled more of that stuff witch is currently not

already solve the issue in this state ...
@chrisshyi would be niche if you can fix more :)

@6543 6543 added this to the 1.13.0 milestone Oct 12, 2020
@chrisshyi
Copy link
Contributor Author

chrisshyi commented Oct 12, 2020

Could you add handling to routers/api/v1/repo/key.go:172-183:func HandleAddKeyError(ctx *context.APIContext, err error) { too?

I just did!

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Oct 12, 2020
@codecov-io
Copy link

codecov-io commented Oct 12, 2020

Codecov Report

Merging #13112 into master will increase coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #13112   +/-   ##
=======================================
  Coverage   42.52%   42.52%           
=======================================
  Files         673      673           
  Lines       74111    74116    +5     
=======================================
+ Hits        31514    31517    +3     
  Misses      37478    37478           
- Partials     5119     5121    +2     
Impacted Files Coverage Δ
models/error.go 34.34% <0.00%> (-0.51%) ⬇️
routers/api/v1/repo/key.go 16.85% <0.00%> (-0.39%) ⬇️
routers/repo/setting.go 14.62% <0.00%> (-0.08%) ⬇️
modules/indexer/stats/db.go 43.47% <0.00%> (-17.40%) ⬇️
modules/indexer/stats/queue.go 64.70% <0.00%> (-11.77%) ⬇️
modules/git/utils.go 73.77% <0.00%> (-3.28%) ⬇️
modules/git/repo.go 46.19% <0.00%> (-1.53%) ⬇️
modules/queue/workerpool.go 58.77% <0.00%> (-1.23%) ⬇️
services/pull/pull.go 40.78% <0.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e4f663...f46c127. Read the comment docs.

@6543
Copy link
Member

6543 commented Oct 12, 2020

🚀

@zeripath zeripath merged commit c752cce into go-gitea:master Oct 12, 2020
@chrisshyi
Copy link
Contributor Author

also I suspect that we need to "handle" more of the "expected" errors in models/user.go:1751-1772:func addLdapSSHPublicKeys(usr *User, s *LoginSource, sshPublicKeys []string) bool {

I'll see if I can tackle that in another PR. Thank you both for the speedy review!

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding deploy key with duplicate name: unclear error message
5 participants