1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-28 21:28:38 +00:00

Fix error logs and improve some comments/messages (#35105)

This commit is contained in:
wxiaoguang
2025-07-17 19:09:54 +08:00
committed by GitHub
parent 891a827158
commit de1114b4e8
14 changed files with 19 additions and 41 deletions

View File

@@ -34,7 +34,6 @@ func (a *Auth) Verify(req *http.Request, w http.ResponseWriter, store auth.DataS
u, err := user_model.GetUserByID(req.Context(), packageMeta.UserID)
if err != nil {
log.Error("GetUserByID: %v", err)
return nil, err
}
if packageMeta.Scope != "" {

View File

@@ -55,9 +55,7 @@ func jsonResponse(ctx *context.Context, status int, obj any) {
// https://github.com/conan-io/conan/issues/6613
ctx.Resp.Header().Set("Content-Type", "application/json")
ctx.Status(status)
if err := json.NewEncoder(ctx.Resp).Encode(obj); err != nil {
log.Error("JSON encode: %v", err)
}
_ = json.NewEncoder(ctx.Resp).Encode(obj)
}
func apiError(ctx *context.Context, status int, obj any) {
@@ -392,7 +390,6 @@ func uploadFile(ctx *context.Context, fileFilter container.Set[string], fileKey
if isConanfileFile {
metadata, err := conan_module.ParseConanfile(buf)
if err != nil {
log.Error("Error parsing package metadata: %v", err)
apiError(ctx, http.StatusInternalServerError, err)
return
}
@@ -418,7 +415,6 @@ func uploadFile(ctx *context.Context, fileFilter container.Set[string], fileKey
} else {
info, err := conan_module.ParseConaninfo(buf)
if err != nil {
log.Error("Error parsing conan info: %v", err)
apiError(ctx, http.StatusInternalServerError, err)
return
}