From dda88488ca3eca76510c95683035c28f1c10bff6 Mon Sep 17 00:00:00 2001 From: oliverpool Date: Tue, 19 Mar 2024 16:17:24 +0100 Subject: [PATCH] packages: skip error logging on duplicate --- services/packages/packages.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/packages/packages.go b/services/packages/packages.go index 64b1ddd86..8f688a74f 100644 --- a/services/packages/packages.go +++ b/services/packages/packages.go @@ -165,11 +165,15 @@ func createPackageAndVersion(ctx context.Context, pvci *PackageCreationInfo, all if pv, err = packages_model.GetOrInsertVersion(ctx, pv); err != nil { if err == packages_model.ErrDuplicatePackageVersion { versionCreated = false - } - if err != packages_model.ErrDuplicatePackageVersion || !allowDuplicate { + } else { log.Error("Error inserting package: %v", err) return nil, false, err } + + if !allowDuplicate { + // no need to log an error + return nil, false, err + } } if versionCreated {