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

teams-service: cut down "create team" error strings #1134

Merged
merged 2 commits into from
Aug 2, 2019
Merged

Conversation

srenatus
Copy link
Contributor

@srenatus srenatus commented Aug 1, 2019

There' some decent guidance here: https://github.com/golang/go/wiki/Errors

Error strings should

  • start with lowercase
  • be specific: if create fails, don't say that create failed
  • not end with a period

...because they might be wrapped, as it happens in this case: When this error
bubbles up in the UI, it'll say

Could not create team: unable to create team: a team with name "..." already exists..

@srenatus srenatus added bug 🐛 Something isn't working automate-auth auth-team anything that needs to be on the auth team board labels Aug 1, 2019
@srenatus srenatus self-assigned this Aug 1, 2019
Copy link
Contributor

@msorens msorens left a comment

Choose a reason for hiding this comment

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

Nice!

There' some decent guidance here: https://github.com/golang/go/wiki/Errors

Error strings should

- start with lowercase
- be specific: if create fails, don't say that create failed
- not end with a period

...because they might be wrapped, as it happens in this case: When this error
bubbles up in the UI, it'll say

> Could not create team: unable to create team: a team with name "..." already exists..

Signed-off-by: Stephan Renatus <[email protected]>
@srenatus srenatus force-pushed the sr/nitpicks branch 2 times, most recently from e81c799 to 1610f73 Compare August 2, 2019 07:02
I've never seen this happen, so we shouldn't sweat it; but

    status.Error(codes.Xyz, fmt.Sprintf(..., ...))

should really be

    status.Errorf(codes.Xyz, ..., ...)

Signed-off-by: Stephan Renatus <[email protected]>
@srenatus srenatus merged commit e4ae3ff into master Aug 2, 2019
@chef-ci chef-ci deleted the sr/nitpicks branch August 2, 2019 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth-team anything that needs to be on the auth team board automate-auth bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants