-
Notifications
You must be signed in to change notification settings - Fork 489
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
using standard error code to replace terror #982
Conversation
terror/terror.go
Outdated
var rfcCode = fmt.Sprintf("%s:%d", errClass2Desc[ec], code) | ||
err := errors.Normalize(message, errors.MySQLErrorCode(int(code)), errors.RFCCodeText(rfcCode)) | ||
errCodeMap[code] = err | ||
tags := strings.Split(rfcCode, ":") | ||
class := tags[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var rfcCode = fmt.Sprintf("%s:%d", errClass2Desc[ec], code) | |
err := errors.Normalize(message, errors.MySQLErrorCode(int(code)), errors.RFCCodeText(rfcCode)) | |
errCodeMap[code] = err | |
tags := strings.Split(rfcCode, ":") | |
class := tags[0] | |
class := errClass2Desc[ec] | |
rfcCode := fmt.Sprintf("%s:%d", class, code) | |
err := errors.Normalize(message, errors.MySQLErrorCode(int(code)), errors.RFCCodeText(rfcCode)) | |
errCodeMap[code] = err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PTAL @kennytm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
cherry pick to release-4.0 failed |
What problem does this PR solve?
According to RFC, TiDB need to adjust error format and using standard error to replace terror. The standard error has been implemented in https://github.com/pingcap/errors/tree/standard-error
What is changed and how it works?
Since standard error is very similar with
terror
. We can change very few api to replace theterror
. Just renameterror.Error
witherrors.Error
Check List
Tests
Code changes
Side effects
Related changes