Monorepo for Tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview: add more logs to debug knot xrpc failure

Signed-off-by: Seongmin Lee <git@boltless.me>

+58 -52
+22 -18
appview/pulls/pulls.go
··· 345 345 // combine each patch 346 346 patch := mergeable.CombinedPatch() 347 347 348 - resp, xe := tangled.RepoMergeCheck( 348 + resp, err := tangled.RepoMergeCheck( 349 349 r.Context(), 350 350 &xrpcc, 351 351 &tangled.RepoMergeCheck_Input{ ··· 355 355 Patch: patch, 356 356 }, 357 357 ) 358 - if err := xrpcclient.HandleXrpcErr(xe); err != nil { 359 - s.logger.Error("failed to check for mergeability", "err", err, "pull_id", pull.PullId, "target_branch", pull.TargetBranch) 358 + if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 359 + s.logger.Error("failed to check for mergeability", "xrpcerr", xrpcerr, "err", err, "pull_id", pull.PullId, "target_branch", pull.TargetBranch) 360 360 return types.MergeCheckResponse{ 361 - Error: fmt.Sprintf("failed to check merge status: %s", err.Error()), 361 + Error: fmt.Sprintf("failed to check merge status: %s", xrpcerr.Error()), 362 362 } 363 363 } 364 364 ··· 423 423 xrpcc := &indigoxrpc.Client{Host: s.config.KnotMirror.Url} 424 424 resp, err := tangled.GitTempGetBranch(r.Context(), xrpcc, branch, repo.RepoAt().String()) 425 425 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 426 + s.logger.Error("failed to get branch", "xrpcerr", xrpcerr, "err", err) 426 427 return nil 427 428 } 428 429 ··· 448 449 branchResp, err := tangled.GitTempGetBranch(r.Context(), xrpcc, pull.PullSource.Branch, sourceRepo.String()) 449 450 if err != nil { 450 451 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 451 - s.logger.Error("failed to call XRPC repo.branches", "err", xrpcerr, "pull_id", pull.PullId, "branch", pull.PullSource.Branch) 452 + s.logger.Error("failed to call XRPC repo.branches", "xrpcerr", xrpcerr, "err", err, "pull_id", pull.PullId, "branch", pull.PullSource.Branch) 452 453 return pages.Unknown 453 454 } 454 455 s.logger.Error("failed to reach knotserver", "err", err, "pull_id", pull.PullId) ··· 934 935 xrpcBytes, err := tangled.GitTempListBranches(r.Context(), xrpcc, "", 0, f.RepoAt().String()) 935 936 if err != nil { 936 937 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 937 - l.Error("failed to call XRPC repo.branches", "err", xrpcerr) 938 + l.Error("failed to call XRPC repo.branches", "xrpcerr", xrpcerr, "err", err) 938 939 s.pages.Error503(w) 939 940 return 940 941 } ··· 1101 1102 xrpcBytes, err := tangled.RepoCompare(r.Context(), xrpcc, repo.RepoIdentifier(), targetBranch, sourceBranch) 1102 1103 if err != nil { 1103 1104 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 1104 - l.Error("failed to call XRPC repo.compare", "err", xrpcerr) 1105 + l.Error("failed to call XRPC repo.compare", "xrpcerr", xrpcerr, "err", err) 1105 1106 s.pages.Notice(w, "pull", "Failed to create pull request. Try again later.") 1106 1107 return 1107 1108 } ··· 1179 1180 Repo: fork.RepoAt().String(), 1180 1181 }, 1181 1182 ) 1182 - if err := xrpcclient.HandleXrpcErr(err); err != nil { 1183 - s.pages.Notice(w, "pull", err.Error()) 1183 + if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 1184 + s.logger.Error("failed to set hidden ref", "xrpcerr", xrpcerr, "err", err) 1185 + s.pages.Notice(w, "pull", xrpcerr.Error()) 1184 1186 return 1185 1187 } 1186 1188 ··· 1211 1213 forkXrpcBytes, err := tangled.RepoCompare(r.Context(), forkXrpcc, fork.RepoIdentifier(), hiddenRef, sourceBranch) 1212 1214 if err != nil { 1213 1215 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 1214 - l.Error("failed to call XRPC repo.compare for fork", "err", xrpcerr, "hidden_ref", hiddenRef) 1216 + l.Error("failed to call XRPC repo.compare for fork", "xrpcerr", xrpcerr, "err", err, "hidden_ref", hiddenRef) 1215 1217 s.pages.Notice(w, "pull", "Failed to create pull request. Try again later.") 1216 1218 return 1217 1219 } ··· 1665 1667 sourceXrpcBytes, err := tangled.GitTempListBranches(r.Context(), xrpcc, "", 0, repo.RepoAt().String()) 1666 1668 if err != nil { 1667 1669 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 1668 - l.Error("failed to call XRPC repo.branches for source", "err", xrpcerr) 1670 + l.Error("failed to call XRPC repo.branches for source", "xrpcerr", xrpcerr, "err", err) 1669 1671 s.pages.Error503(w) 1670 1672 return 1671 1673 } ··· 1684 1686 targetXrpcBytes, err := tangled.GitTempListBranches(r.Context(), xrpcc, "", 0, f.RepoAt().String()) 1685 1687 if err != nil { 1686 1688 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 1687 - l.Error("failed to call XRPC repo.branches for target", "err", xrpcerr) 1689 + l.Error("failed to call XRPC repo.branches for target", "xrpcerr", xrpcerr, "err", err) 1688 1690 s.pages.Error503(w) 1689 1691 return 1690 1692 } ··· 1828 1830 xrpcBytes, err := tangled.RepoCompare(r.Context(), xrpcc, f.RepoIdentifier(), pull.TargetBranch, pull.PullSource.Branch) 1829 1831 if err != nil { 1830 1832 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 1831 - l.Error("failed to call XRPC repo.compare", "err", xrpcerr, "source_branch", pull.PullSource.Branch) 1833 + l.Error("failed to call XRPC repo.compare", "xrpcerr", xrpcerr, "err", err, "source_branch", pull.PullSource.Branch) 1832 1834 s.pages.Notice(w, "resubmit-error", "Failed to create pull request. Try again later.") 1833 1835 return 1834 1836 } ··· 1907 1909 Repo: forkRepo.RepoAt().String(), 1908 1910 }, 1909 1911 ) 1910 - if err := xrpcclient.HandleXrpcErr(err); err != nil { 1911 - s.pages.Notice(w, "resubmit-error", err.Error()) 1912 + if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 1913 + s.logger.Error("failed to set hidden ref", "xrpcerr", xrpcerr, "err", err) 1914 + s.pages.Notice(w, "resubmit-error", xrpcerr.Error()) 1912 1915 return 1913 1916 } 1914 1917 if !resp.Success { ··· 1927 1930 forkXrpcBytes, err := tangled.RepoCompare(r.Context(), &indigoxrpc.Client{Host: forkHost}, forkRepo.RepoIdentifier(), hiddenRef, pull.PullSource.Branch) 1928 1931 if err != nil { 1929 1932 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 1930 - l.Error("failed to call XRPC repo.compare for fork", "err", xrpcerr, "hidden_ref", hiddenRef, "source_branch", pull.PullSource.Branch) 1933 + l.Error("failed to call XRPC repo.compare for fork", "xrpcerr", xrpcerr, "err", err, "hidden_ref", hiddenRef, "source_branch", pull.PullSource.Branch) 1931 1934 s.pages.Notice(w, "resubmit-error", "Failed to create pull request. Try again later.") 1932 1935 return 1933 1936 } ··· 2390 2393 } 2391 2394 2392 2395 err = tangled.RepoMerge(r.Context(), client, mergeInput) 2393 - if err := xrpcclient.HandleXrpcErr(err); err != nil { 2394 - s.pages.Notice(w, "pull-merge-error", err.Error()) 2396 + if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 2397 + s.logger.Error("failed to merge", "xrpcerr", xrpcerr, "err", err) 2398 + s.pages.Notice(w, "pull-merge-error", xrpcerr.Error()) 2395 2399 return 2396 2400 } 2397 2401
+1 -1
appview/repo/artifact.go
··· 312 312 xrpcBytes, err := tangled.GitTempListTags(ctx, xrpcc, "", 0, f.RepoAt().String()) 313 313 if err != nil { 314 314 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 315 - l.Error("failed to call XRPC repo.tags", "err", xrpcerr) 315 + l.Error("failed to call XRPC repo.tags", "xrpcerr", xrpcerr, "err", err) 316 316 return nil, xrpcerr 317 317 } 318 318 l.Error("failed to reach knotserver", "err", err)
+1 -1
appview/repo/blob.go
··· 61 61 } 62 62 resp, err := tangled.RepoBlob(r.Context(), xrpcc, filePath, false, ref, f.RepoIdentifier()) 63 63 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 64 - l.Error("failed to call XRPC repo.blob", "err", xrpcerr) 64 + l.Error("failed to call XRPC repo.blob", "xrpcerr", xrpcerr, "err", err) 65 65 rp.pages.Error503(w) 66 66 return 67 67 }
+6 -8
appview/repo/branches.go
··· 52 52 return 53 53 } 54 54 noticeId := "delete-branch-error" 55 - fail := func(msg string, err error) { 56 - l.Error(msg, "err", err) 57 - rp.pages.Notice(w, noticeId, msg) 58 - } 59 55 branch := r.FormValue("branch") 60 56 if branch == "" { 61 - fail("No branch provided.", nil) 57 + rp.pages.Notice(w, noticeId, "No branch provided.") 62 58 return 63 59 } 64 60 client, err := rp.oauth.ServiceClient( ··· 68 64 oauth.WithDev(rp.config.Core.Dev), 69 65 ) 70 66 if err != nil { 71 - fail("Failed to connect to knotserver", nil) 67 + l.Warn("Failed to connect to knotserver", "err", err) 68 + rp.pages.Notice(w, noticeId, "Failed to connect to knotserver") 72 69 return 73 70 } 74 71 err = tangled.RepoDeleteBranch( ··· 79 76 Repo: f.RepoAt().String(), 80 77 }, 81 78 ) 82 - if err := xrpcclient.HandleXrpcErr(err); err != nil { 83 - fail(fmt.Sprintf("Failed to delete branch: %s", err), err) 79 + if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 80 + l.Error("Faield to delete branch", "xrpcerr", xrpcerr, "err", err) 81 + rp.pages.Notice(w, noticeId, fmt.Sprintf("Failed to delete branch: %s", xrpcerr)) 84 82 return 85 83 } 86 84 l.Error("deleted branch from knot", "branch", branch, "repo", f.RepoAt())
+5 -5
appview/repo/compare.go
··· 31 31 32 32 branchBytes, err := tangled.GitTempListBranches(r.Context(), xrpcc, "", 0, f.RepoAt().String()) 33 33 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 34 - l.Error("failed to call XRPC repo.branches", "err", xrpcerr) 34 + l.Error("failed to call XRPC repo.branches", "xrpcerr", xrpcerr, "err", err) 35 35 rp.pages.Error503(w) 36 36 return 37 37 } ··· 68 68 69 69 tagBytes, err := tangled.GitTempListTags(r.Context(), xrpcc, "", 0, f.RepoAt().String()) 70 70 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 71 - l.Error("failed to call XRPC repo.tags", "err", xrpcerr) 71 + l.Error("failed to call XRPC repo.tags", "xrpcerr", xrpcerr, "err", err) 72 72 rp.pages.Error503(w) 73 73 return 74 74 } ··· 145 145 146 146 branchBytes, err := tangled.RepoBranches(r.Context(), xrpcc, "", 0, repoId) 147 147 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 148 - l.Error("failed to call XRPC repo.branches", "err", xrpcerr) 148 + l.Error("failed to call XRPC repo.branches", "xrpcerr", xrpcerr, "err", err) 149 149 rp.pages.Error503(w) 150 150 return 151 151 } ··· 159 159 160 160 tagBytes, err := tangled.RepoTags(r.Context(), xrpcc, "", 0, repoId) 161 161 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 162 - l.Error("failed to call XRPC repo.tags", "err", xrpcerr) 162 + l.Error("failed to call XRPC repo.tags", "xrpcerr", xrpcerr, "err", err) 163 163 rp.pages.Error503(w) 164 164 return 165 165 } ··· 173 173 174 174 compareBytes, err := tangled.RepoCompare(r.Context(), xrpcc, repoId, base, head) 175 175 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 176 - l.Error("failed to call XRPC repo.compare", "err", xrpcerr) 176 + l.Error("failed to call XRPC repo.compare", "xrpcerr", xrpcerr, "err", err) 177 177 rp.pages.Error503(w) 178 178 return 179 179 }
+2 -2
appview/repo/log.go
··· 57 57 58 58 xrpcBytes, err := tangled.RepoDiff(r.Context(), xrpcc, ref, f.RepoIdentifier()) 59 59 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 60 - l.Error("failed to call XRPC repo.diff", "err", xrpcerr) 60 + l.Error("failed to call XRPC repo.diff", "xrpcerr", xrpcerr, "err", err) 61 61 rp.pages.Error503(w) 62 62 return 63 63 } ··· 227 227 228 228 xrpcBytes, err := tangled.RepoDiff(r.Context(), xrpcc, ref, f.RepoIdentifier()) 229 229 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 230 - l.Error("failed to call XRPC repo.diff", "err", xrpcerr) 230 + l.Error("failed to call XRPC repo.diff", "xrpcerr", xrpcerr, "err", err) 231 231 rp.pages.Error503(w) 232 232 return 233 233 }
+9 -6
appview/repo/repo.go
··· 879 879 Rkey: f.Rkey, 880 880 }, 881 881 ) 882 - if err := xrpcclient.HandleXrpcErr(err); err != nil { 883 - rp.pages.Notice(w, noticeId, err.Error()) 882 + if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 883 + l.Error("failed to call XRPC repo.delete", "xrpcerr", xrpcerr, "err", err) 884 + rp.pages.Notice(w, noticeId, xrpcerr.Error()) 884 885 return 885 886 } 886 887 l.Info("deleted repo from knot") ··· 985 986 Branch: ref, 986 987 }, 987 988 ) 988 - if err := xrpcclient.HandleXrpcErr(err); err != nil { 989 + if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 990 + l.Error("failed to call XRPC repo.forkSync", "xrpcerr", xrpcerr, "err", err) 989 991 rp.pages.Notice(w, "repo", err.Error()) 990 992 return 991 993 } ··· 1092 1094 Name: forkName, 1093 1095 Source: &forkSourceUrl, 1094 1096 } 1095 - createResp, createErr := tangled.RepoCreate( 1097 + createResp, err := tangled.RepoCreate( 1096 1098 r.Context(), 1097 1099 client, 1098 1100 forkInput, 1099 1101 ) 1100 - if err := xrpcclient.HandleXrpcErr(createErr); err != nil { 1101 - rp.pages.Notice(w, "repo", err.Error()) 1102 + if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 1103 + l.Error("failed to call XRPC repo.create", "xrpcerr", xrpcerr, "err", err) 1104 + rp.pages.Notice(w, "repo", xrpcerr.Error()) 1102 1105 return 1103 1106 } 1104 1107
+6 -6
appview/repo/settings.go
··· 54 54 return 55 55 } 56 56 57 - xe := tangled.RepoSetDefaultBranch( 57 + err = tangled.RepoSetDefaultBranch( 58 58 r.Context(), 59 59 client, 60 60 &tangled.RepoSetDefaultBranch_Input{ ··· 62 62 DefaultBranch: branch, 63 63 }, 64 64 ) 65 - if err := xrpcclient.HandleXrpcErr(xe); err != nil { 66 - l.Error("xrpc failed", "err", xe) 67 - rp.pages.Notice(w, noticeId, err.Error()) 65 + if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 66 + l.Error("failed to call XRPC repo.setDefaultBranch", "xrpcerr", xrpcerr, "err", err) 67 + rp.pages.Notice(w, noticeId, xrpcerr.Error()) 68 68 return 69 69 } 70 70 ··· 200 200 repo := fmt.Sprintf("%s/%s", f.Did, f.Name) 201 201 xrpcBytes, err := tangled.RepoBranches(r.Context(), xrpcc, "", 0, repo) 202 202 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 203 - l.Error("failed to call XRPC repo.branches", "err", xrpcerr) 203 + l.Error("failed to call XRPC repo.branches", "xrpcerr", xrpcerr, "err", err) 204 204 rp.pages.Error503(w) 205 205 return 206 206 } ··· 385 385 xrpcBytes, err := tangled.GitTempListBranches(r.Context(), xrpcc, "", 0, f.RepoAt().String()) 386 386 var result types.RepoBranchesResponse 387 387 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 388 - l.Error("failed to call XRPC repo.branches", "err", xrpcerr) 388 + l.Error("failed to call XRPC git.listBranches", "xrpcerr", xrpcerr, "err", err) 389 389 } else if err := json.Unmarshal(xrpcBytes, &result); err != nil { 390 390 l.Error("failed to decode XRPC response", "err", err) 391 391 rp.pages.Error503(w)
+2 -1
appview/repo/tags.go
··· 90 90 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 91 91 // if we don't match an existing tag, and the tag we're trying 92 92 // to match is "latest", resolve to the most recent tag 93 + l.Info("failed to call XRPC git.getTag", "xrpcerr", xrpcerr, "err", err, "tag", tag) 93 94 if tag == "latest" { 94 95 tagsBytes, err := tangled.GitTempListTags(r.Context(), xrpcc, "", 1, f.RepoAt().String()) 95 96 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 96 - l.Error("failed to call XRPC repo.tags for latest", "err", xrpcerr) 97 + l.Error("failed to call XRPC git.ListTags for latest", "xrpcerr", xrpcerr, "err", err) 97 98 rp.pages.Error503(w) 98 99 return 99 100 }
+1 -1
appview/repo/tree.go
··· 37 37 xrpcc := &indigoxrpc.Client{Host: rp.config.KnotMirror.Url} 38 38 xrpcResp, err := tangled.GitTempGetTree(r.Context(), xrpcc, treePath, ref, f.RepoAt().String()) 39 39 if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 40 - l.Error("failed to call XRPC repo.tree", "err", xrpcerr) 40 + l.Error("failed to call XRPC repo.tree", "xrpcerr", xrpcerr, "err", err) 41 41 rp.pages.Error503(w) 42 42 return 43 43 }
+3 -3
appview/state/state.go
··· 479 479 Name: repoName, 480 480 DefaultBranch: &defaultBranch, 481 481 } 482 - createResp, xe := tangled.RepoCreate( 482 + createResp, err := tangled.RepoCreate( 483 483 r.Context(), 484 484 client, 485 485 input, 486 486 ) 487 - if err := xrpcclient.HandleXrpcErr(xe); err != nil { 488 - l.Error("xrpc error", "xe", xe) 487 + if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil { 488 + l.Error("failed to call XRPC repo.create", "xrpcerr", xrpcerr, "err", err) 489 489 s.pages.Notice(w, "repo", err.Error()) 490 490 return 491 491 }