+1
-4
knotserver/xrpc/repo_branch.go
+1
-4
knotserver/xrpc/repo_branch.go
···
32
32
33
33
gr, err := git.PlainOpen(repoPath)
34
34
if err != nil {
35
-
writeError(w, xrpcerr.NewXrpcError(
36
-
xrpcerr.WithTag("RepoNotFound"),
37
-
xrpcerr.WithMessage("repository not found"),
38
-
), http.StatusNotFound)
35
+
writeError(w, xrpcerr.RepoNotFoundError, http.StatusNoContent)
39
36
return
40
37
}
41
38
+1
-4
knotserver/xrpc/repo_branches.go
+1
-4
knotserver/xrpc/repo_branches.go
···
31
31
32
32
gr, err := git.PlainOpen(repoPath)
33
33
if err != nil {
34
-
writeError(w, xrpcerr.NewXrpcError(
35
-
xrpcerr.WithTag("RepoNotFound"),
36
-
xrpcerr.WithMessage("repository not found"),
37
-
), http.StatusNotFound)
34
+
writeError(w, xrpcerr.RepoNotFoundError, http.StatusNoContent)
38
35
return
39
36
}
40
37
+1
-4
knotserver/xrpc/repo_compare.go
+1
-4
knotserver/xrpc/repo_compare.go
···
38
38
39
39
gr, err := git.PlainOpen(repoPath)
40
40
if err != nil {
41
-
writeError(w, xrpcerr.NewXrpcError(
42
-
xrpcerr.WithTag("RepoNotFound"),
43
-
xrpcerr.WithMessage("repository not found"),
44
-
), http.StatusNotFound)
41
+
writeError(w, xrpcerr.RepoNotFoundError, http.StatusNoContent)
45
42
return
46
43
}
47
44
+2
-8
knotserver/xrpc/xrpc.go
+2
-8
knotserver/xrpc/xrpc.go
···
101
101
// Construct repository path using the same logic as didPath
102
102
didRepoPath, err := securejoin.SecureJoin(did, repoName)
103
103
if err != nil {
104
-
return "", xrpcerr.NewXrpcError(
105
-
xrpcerr.WithTag("RepoNotFound"),
106
-
xrpcerr.WithMessage("failed to access repository"),
107
-
)
104
+
return "", xrpcerr.RepoNotFoundError
108
105
}
109
106
110
107
repoPath, err := securejoin.SecureJoin(x.Config.Repo.ScanPath, didRepoPath)
111
108
if err != nil {
112
-
return "", xrpcerr.NewXrpcError(
113
-
xrpcerr.WithTag("RepoNotFound"),
114
-
xrpcerr.WithMessage("failed to access repository"),
115
-
)
109
+
return "", xrpcerr.RepoNotFoundError
116
110
}
117
111
118
112
return repoPath, nil
+5
xrpc/errors/errors.go
+5
xrpc/errors/errors.go
···
56
56
WithMessage("owner not set for this service"),
57
57
)
58
58
59
+
var RepoNotFoundError = NewXrpcError(
60
+
WithTag("RepoNotFound"),
61
+
WithMessage("failed to access repository"),
62
+
)
63
+
59
64
var AuthError = func(err error) XrpcError {
60
65
return NewXrpcError(
61
66
WithTag("Auth"),