You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/09/15 07:15:17 UTC

[GitHub] [incubator-devlake] abeizn commented on a diff in pull request #3076: fix(github): fix test conn

abeizn commented on code in PR #3076:
URL: https://github.com/apache/incubator-devlake/pull/3076#discussion_r971612956


##########
plugins/github/api/connection.go:
##########
@@ -90,18 +90,23 @@ func TestConnection(input *core.ApiResourceInput) (*core.ApiResourceOutput, erro
 				results <- VerifyResult{err: errors.Default.Wrap(err, fmt.Sprintf("verify token failed for #%v %s", j, token))}
 				return
 			} else if githubUserOfToken.Login == "" {
-				results <- VerifyResult{err: errors.Default.Wrap(err, fmt.Sprintf("invalid token for #%v %s", j, token))}
+				results <- VerifyResult{err: errors.Default.Wrap(errors.Unauthorized.New("invalid token"), fmt.Sprintf("invalid token for #%v %s", j, token))}
+				return
+			} else {
+				results <- VerifyResult{login: githubUserOfToken.Login}
 				return
 			}
-			results <- VerifyResult{login: githubUserOfToken.Login}
 		}()
 	}
 
 	// collect verification results
 	logins := make([]string, 0)
 	msgs := make([]string, 0)
 	i := 0
+	fmt.Println("444444", len(results))

Review Comment:
   please delete it.



##########
plugins/github/api/connection.go:
##########
@@ -90,18 +90,23 @@ func TestConnection(input *core.ApiResourceInput) (*core.ApiResourceOutput, erro
 				results <- VerifyResult{err: errors.Default.Wrap(err, fmt.Sprintf("verify token failed for #%v %s", j, token))}
 				return
 			} else if githubUserOfToken.Login == "" {
-				results <- VerifyResult{err: errors.Default.Wrap(err, fmt.Sprintf("invalid token for #%v %s", j, token))}
+				results <- VerifyResult{err: errors.Default.Wrap(errors.Unauthorized.New("invalid token"), fmt.Sprintf("invalid token for #%v %s", j, token))}
+				return
+			} else {
+				results <- VerifyResult{login: githubUserOfToken.Login}
 				return
 			}
-			results <- VerifyResult{login: githubUserOfToken.Login}
 		}()
 	}
 
 	// collect verification results
 	logins := make([]string, 0)
 	msgs := make([]string, 0)
 	i := 0
+	fmt.Println("444444", len(results))
 	for result := range results {
+		fmt.Println("3333333", result)

Review Comment:
   same as above



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org