Skip to content

Commit

Permalink
ajoute le nom du fichier d'où provient l'erreur
Browse files Browse the repository at this point in the history
  • Loading branch information
Josquin Cornec committed Sep 5, 2024
1 parent b67c931 commit 7ddc696
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/marshal/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func readFilterFiles(basePath string, filenames []base.BatchFile) (SirenFilter,
return nil, errors.New("Erreur à l'ouverture du fichier, " + err.Error())
}
defer file.Close()
err = readFilter(bufio.NewReader(file), filter)
err = readFilter(bufio.NewReader(file), filter, filepath.Base(file.Name()))
if err != nil {
return nil, errors.New("Erreur à la lecture du fichier, " + err.Error())
}
Expand All @@ -103,7 +103,7 @@ func readFilterFiles(basePath string, filenames []base.BatchFile) (SirenFilter,

// readFilter reads the content of a io.Reader and adds it to an existing
// filter
func readFilter(reader io.Reader, filter SirenFilter) error {
func readFilter(reader io.Reader, filter SirenFilter, filename string) error {

csvreader := csv.NewReader(reader)
csvreader.Comma = ';'
Expand All @@ -123,7 +123,7 @@ func readFilter(reader io.Reader, filter SirenFilter) error {
if sfregexp.RegexpDict["siren"].MatchString(siren) {
filter[siren] = true
} else {
return errors.New("Format de siren incorrect trouvé : " + siren)
return fmt.Errorf("Format de siren incorrect trouvé : %s dans le fichier %s", siren, filename)

Check failure on line 126 in lib/marshal/filter.go

View workflow job for this annotation

GitHub Actions / Push OpenSignauxFaibles container

undefined: fmt

Check failure on line 126 in lib/marshal/filter.go

View workflow job for this annotation

GitHub Actions / Go tests

undefined: fmt

Check failure on line 126 in lib/marshal/filter.go

View workflow job for this annotation

GitHub Actions / Generate and lint

undefined: fmt

Check failure on line 126 in lib/marshal/filter.go

View workflow job for this annotation

GitHub Actions / End-to-end tests

undefined: fmt
}
}
return nil
Expand Down

0 comments on commit 7ddc696

Please sign in to comment.