fix: improve error wrapping & preserving the error (#57)

This commit is contained in:
Sahil Bansal
2025-07-28 18:03:29 +05:30
committed by GitHub
parent c486834c2e
commit e184e914a3
2 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ func parseRequirementsTxtFile(lockfilePath, scanDir string) ([]*packagev1.Packag
file, err := os.Open(lockfilePath)
if err != nil {
return nil, fmt.Errorf("failed to open lockfile: %s", err)
return nil, fmt.Errorf("failed to open lockfile: %w", err)
}
defer file.Close()
@@ -47,7 +47,7 @@ func parseRequirementsTxtFile(lockfilePath, scanDir string) ([]*packagev1.Packag
inventory, err := requirementsExtractor.Extract(context.Background(), inputConfig)
if err != nil {
return nil, fmt.Errorf("failed to extract packages: %s", err)
return nil, fmt.Errorf("failed to extract packages: %w", err)
}
var packages []*packagev1.PackageVersion