···3333 gr, err := git.PlainOpen(repoPath)3434 if err != nil {3535 x.Logger.Error("failed to open", "error", err)3636- writeError(w, xrpcerr.NewXrpcError(3737- xrpcerr.WithTag("RepoNotFound"),3838- xrpcerr.WithMessage("repository not found"),3939- ), http.StatusNoContent)3636+ writeError(w, xrpcerr.RepoNotFoundError, http.StatusNoContent)4037 return4138 }4239
+2-8
knotserver/xrpc/xrpc.go
···101101 // Construct repository path using the same logic as didPath102102 didRepoPath, err := securejoin.SecureJoin(did, repoName)103103 if err != nil {104104- return "", xrpcerr.NewXrpcError(105105- xrpcerr.WithTag("RepoNotFound"),106106- xrpcerr.WithMessage("failed to access repository"),107107- )104104+ return "", xrpcerr.RepoNotFoundError108105 }109106110107 repoPath, err := securejoin.SecureJoin(x.Config.Repo.ScanPath, didRepoPath)111108 if err != nil {112112- return "", xrpcerr.NewXrpcError(113113- xrpcerr.WithTag("RepoNotFound"),114114- xrpcerr.WithMessage("failed to access repository"),115115- )109109+ return "", xrpcerr.RepoNotFoundError116110 }117111118112 return repoPath, nil
+5
xrpc/errors/errors.go
···5656 WithMessage("owner not set for this service"),5757)58585959+var RepoNotFoundError = NewXrpcError(6060+ WithTag("RepoNotFound"),6161+ WithMessage("failed to access repository"),6262+)6363+5964var AuthError = func(err error) XrpcError {6065 return NewXrpcError(6166 WithTag("Auth"),