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

*: fix some error related issues #4032

Merged
merged 3 commits into from
Aug 5, 2017
Merged

*: fix some error related issues #4032

merged 3 commits into from
Aug 5, 2017

Conversation

breezewish
Copy link
Member

Fix:

  • Some errors do not have correct parameters.
  • Errors that contain "%" in the message body are not correctly printed to the client.

@tiancaiamao
Copy link
Contributor

LGTM
Please make sure tidb-test can pass it, some of them check error message.

@tiancaiamao tiancaiamao added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 5, 2017
@@ -257,7 +257,7 @@ func (e *Error) NotEqual(err error) bool {
// ToSQLError convert Error to mysql.SQLError.
func (e *Error) ToSQLError() *mysql.SQLError {
code := e.getMySQLErrorCode()
return mysql.NewErrf(code, e.getMsg())
return mysql.NewErrf(code, "%s", e.getMsg())
Copy link
Member

Choose a reason for hiding this comment

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

Can we use mysql.NewErr() here?

Copy link
Member Author

@breezewish breezewish Aug 5, 2017

Choose a reason for hiding this comment

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

@shenli mysql.NewErr cannot be used here. It's functionality is not what we usually expected to be:

mysql.NewErr: NewErr generates a SQL error, with an error code and default format specifier defined in MySQLErrName.

func NewErr(errCode uint16, args ...interface{}) *SQLError

mysql.NewErrf: NewErrf creates a SQL error, with an error code and a format specifier.

func NewErrf(errCode uint16, format string, args ...interface{}) *SQLError

@shenli
Copy link
Member

shenli commented Aug 5, 2017

@breeswish Please resolve the conflicts.

@breezewish
Copy link
Member Author

@shenli Done

@shenli
Copy link
Member

shenli commented Aug 5, 2017

LGTM

@zz-jason zz-jason merged commit e9785fd into master Aug 5, 2017
@zz-jason zz-jason deleted the wenxuan/errorcodes branch August 5, 2017 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants