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

refactor: coderr package #1504

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ShiKaiWi
Copy link
Member

Rationale

Close #1501
Current coderr package's usage is complex and confusing.

Detailed Changes

  • Introduce the CodeErrorDef which is made different from the CodeError
  • Update the usage of the error definition and creation.

Test Plan

Pass the existing CI.

@@ -95,7 +95,7 @@ func main() {
panicf("fail to init global logger, err:%v", err)
}
defer logger.Sync() //nolint:errcheck
log.Info(fmt.Sprintf("server start with version: %s", buildVersion()))
log.Info(fmt.Sprintf("server start with version:%s", buildVersion()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
log.Info(fmt.Sprintf("server start with version:%s", buildVersion()))
log.Info("Start server", zap.String("version", buildVersion()))

errMsg := fmt.Sprintf(format, a...)
causeWithStack := errors.WithStack(errors.New(errMsg))
causeWithStack := errors.WithStack(errors.New(""))
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, this function should not add stack, users can use WithCausef to do this. Otherwise this function is same with WithCausef

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.

Improve log readability for horaemeta
2 participants