Skip to content

Commit

Permalink
Fail fast on parse errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pcj committed Aug 6, 2024
1 parent 5de473b commit 8e18542
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/provider/source_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ func (r *SourceProvider) parseFiles(dir string, srcs []string) ([]*sppb.File, er
return nil, fmt.Errorf("parser error: %s", response.Error)
}

// remove dir prefixes
// check for errors and remove dir prefixes
for _, file := range response.Files {
// TODO(pcj): isn't there a stdlib function that does this?
if file.Error != "" {
return nil, fmt.Errorf("%s parse error: %s", file.Filename, file.Error)
}
file.Filename = strings.TrimPrefix(strings.TrimPrefix(file.Filename, dir), "/")
}

Expand Down

0 comments on commit 8e18542

Please sign in to comment.