Skip to content

Commit 02faa20

Browse files
committed
error messages change
1 parent 48d1dbe commit 02faa20

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packagehandlers/conanpackagehandler.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package packagehandlers
22

33
import (
4-
"errors"
54
"fmt"
65
"github.com/jfrog/frogbot/v2/utils"
76
"github.com/jfrog/jfrog-client-go/utils/log"
@@ -47,23 +46,25 @@ func (conan *ConanPackageHandler) updateDirectDependency(vulnDetails *utils.Vuln
4746
}
4847
if !isAnyDescriptorFileChanged {
4948
err = fmt.Errorf("impacted package '%s' was not found or could not be fixed in all descriptor files", vulnDetails.ImpactedDependencyName)
49+
} else {
50+
conan.logNoInstallationMessage()
5051
}
51-
conan.logNoInstallationMessage()
5252
return
5353
}
5454

5555
func (conan *ConanPackageHandler) updateConanFile(conanFile string, vulnDetails *utils.VulnerabilityDetails) (isFileChanged bool, err error) {
5656
data, err := os.ReadFile(conanFile)
5757
if err != nil {
58-
return false, errors.New("an error occurred while attempting to read the requirements file:\n" + err.Error())
58+
return false, fmt.Errorf("an error occurred while attempting to read the requirements file '%s': %s\n", conanFile, err.Error())
5959
}
6060
currentFile := string(data)
6161
fixedPackage := vulnDetails.ImpactedDependencyName + "/" + vulnDetails.SuggestedFixedVersion
6262
impactedDependency := vulnDetails.ImpactedDependencyName + "/" + vulnDetails.ImpactedDependencyVersion
6363
fixedFile := strings.Replace(currentFile, impactedDependency, strings.ToLower(fixedPackage), 1)
6464

6565
if fixedFile == currentFile {
66-
return false, fmt.Errorf("impacted dependency '%s' not found in descriptor '%s', fix failed vulnerability", impactedDependency, conanFile)
66+
log.Info(fmt.Sprintf("impacted dependency '%s' not found in descriptor '%s', moving to the next descriptor if exists...", impactedDependency, conanFile))
67+
return false, nil
6768
}
6869
if err = os.WriteFile(conanFile, []byte(fixedFile), 0600); err != nil {
6970
err = fmt.Errorf("an error occured while writing the fixed version of %s to the requirements file '%s': %s", conanFile, vulnDetails.ImpactedDependencyName, err.Error())

0 commit comments

Comments
 (0)