@@ -13,7 +13,7 @@ import (
13
13
"sort"
14
14
"strings"
15
15
16
- multierror "github.com/hashicorp/go-multierror"
16
+ "github.com/hashicorp/go-multierror"
17
17
"github.com/samber/lo"
18
18
"golang.org/x/net/html/charset"
19
19
"golang.org/x/xerrors"
@@ -680,18 +680,15 @@ func (p *Parser) fetchPOMFromRemoteRepositories(paths []string, snapshot bool) (
680
680
func (p * Parser ) remoteRepoRequest (repo string , paths []string ) (* http.Request , error ) {
681
681
repoURL , err := url .Parse (repo )
682
682
if err != nil {
683
- p .logger .Error ("URL parse error" , log .String ("repo" , repo ))
684
- return nil , nil
683
+ return nil , xerrors .Errorf ("unable to parse URL: %w" , err )
685
684
}
686
685
687
686
paths = append ([]string {repoURL .Path }, paths ... )
688
687
repoURL .Path = path .Join (paths ... )
689
688
690
- logger := p .logger .With (log .String ("host" , repoURL .Host ), log .String ("path" , repoURL .Path ))
691
689
req , err := http .NewRequest ("GET" , repoURL .String (), http .NoBody )
692
690
if err != nil {
693
- logger .Debug ("HTTP request failed" )
694
- return nil , nil
691
+ return nil , xerrors .Errorf ("unable to create HTTP request: %w" , err )
695
692
}
696
693
if repoURL .User != nil {
697
694
password , _ := repoURL .User .Password ()
@@ -709,7 +706,8 @@ func (p *Parser) fetchPomFileNameFromMavenMetadata(repo string, paths []string)
709
706
710
707
req , err := p .remoteRepoRequest (repo , mavenMetadataPaths )
711
708
if err != nil {
712
- return "" , xerrors .Errorf ("unable to create request for maven-metadata.xml file" )
709
+ p .logger .Debug ("Unable to create request" , log .String ("repo" , repo ), log .Err (err ))
710
+ return "" , nil
713
711
}
714
712
715
713
client := & http.Client {}
@@ -739,7 +737,8 @@ func (p *Parser) fetchPomFileNameFromMavenMetadata(repo string, paths []string)
739
737
func (p * Parser ) fetchPOMFromRemoteRepository (repo string , paths []string ) (* pom , error ) {
740
738
req , err := p .remoteRepoRequest (repo , paths )
741
739
if err != nil {
742
- return nil , xerrors .Errorf ("unable to create request for pom file" )
740
+ p .logger .Debug ("Unable to create request" , log .String ("repo" , repo ), log .Err (err ))
741
+ return nil , nil
743
742
}
744
743
745
744
client := & http.Client {}
0 commit comments