packages: skip error logging on duplicate

This commit is contained in:
oliverpool 2024-03-19 16:17:24 +01:00
parent 7b576d0a5d
commit dda88488ca

View file

@ -165,11 +165,15 @@ func createPackageAndVersion(ctx context.Context, pvci *PackageCreationInfo, all
if pv, err = packages_model.GetOrInsertVersion(ctx, pv); err != nil { if pv, err = packages_model.GetOrInsertVersion(ctx, pv); err != nil {
if err == packages_model.ErrDuplicatePackageVersion { if err == packages_model.ErrDuplicatePackageVersion {
versionCreated = false versionCreated = false
} } else {
if err != packages_model.ErrDuplicatePackageVersion || !allowDuplicate {
log.Error("Error inserting package: %v", err) log.Error("Error inserting package: %v", err)
return nil, false, err return nil, false, err
} }
if !allowDuplicate {
// no need to log an error
return nil, false, err
}
} }
if versionCreated { if versionCreated {