gateway: update and log errors on remoterepo api
This commit is contained in:
parent
51945513bf
commit
03a0d38b10
|
@ -63,7 +63,6 @@ func (h *UserRemoteReposHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
userID := userIDVal.(string)
|
userID := userIDVal.(string)
|
||||||
h.log.Infof("userID: %q", userID)
|
|
||||||
|
|
||||||
user, resp, err := h.configstoreClient.GetUser(ctx, userID)
|
user, resp, err := h.configstoreClient.GetUser(ctx, userID)
|
||||||
if httpErrorFromRemote(w, resp, err) {
|
if httpErrorFromRemote(w, resp, err) {
|
||||||
|
@ -76,7 +75,6 @@ func (h *UserRemoteReposHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques
|
||||||
h.log.Errorf("err: %+v", err)
|
h.log.Errorf("err: %+v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
h.log.Infof("rs: %s", util.Dump(rs))
|
|
||||||
|
|
||||||
var la *types.LinkedAccount
|
var la *types.LinkedAccount
|
||||||
for _, v := range user.LinkedAccounts {
|
for _, v := range user.LinkedAccounts {
|
||||||
|
@ -85,21 +83,25 @@ func (h *UserRemoteReposHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
h.log.Infof("la: %s", util.Dump(la))
|
|
||||||
if la == nil {
|
if la == nil {
|
||||||
httpError(w, util.NewErrBadRequest(errors.Errorf("user doesn't have a linked account for remote source %q", rs.Name)))
|
err := util.NewErrBadRequest(errors.Errorf("user doesn't have a linked account for remote source %q", rs.Name))
|
||||||
|
httpError(w, err)
|
||||||
|
h.log.Errorf("err: %+v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
gitsource, err := h.ah.GetGitSource(ctx, rs, user.Name, la)
|
gitsource, err := h.ah.GetGitSource(ctx, rs, user.Name, la)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httpError(w, util.NewErrBadRequest(errors.Errorf("failed to create gitsource client: %w", err)))
|
httpError(w, err)
|
||||||
|
h.log.Errorf("err: %+v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteRepos, err := gitsource.ListUserRepos()
|
remoteRepos, err := gitsource.ListUserRepos()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httpError(w, util.NewErrBadRequest(errors.Errorf("failed to get user repositories from gitsource: %w", err)))
|
err := util.NewErrBadRequest(errors.Errorf("failed to get user repositories from git source: %w", err))
|
||||||
|
httpError(w, err)
|
||||||
|
h.log.Errorf("err: %+v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue