code: func SyntaxError(err error) error {
  	if err == nil {
  		return nil
  	}
  	logutil.Logger(context.Background()).Error("syntax error", zap.Error(err))
  
  	// If the error is already a terror with stack, pass it through.
  	if errors.HasStack(err) {
  		cause := errors.Cause(err)
  		if _, ok := cause.(*terror.Error); ok {
  			return err
  		}
  	}
  
  	return parser.ErrParse.GenWithStackByArgs(syntaxErrorPrefix, err.Error())
  }
docs: // SyntaxError converts parser error to TiDB's syntax error.