packages: skip error logging on duplicate
This commit is contained in:
		
							parent
							
								
									7b576d0a5d
								
							
						
					
					
						commit
						dda88488ca
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue