Skip to content

Commit

Permalink
fix error logging when validator names cannot be loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Aug 18, 2023
1 parent 740e5cd commit ce599e2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions services/validatornames.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@ func (vn *ValidatorNames) GetValidatorName(index uint64) string {
func (vn *ValidatorNames) LoadFromYaml(fileName string) error {
vn.namesMutex.Lock()
defer vn.namesMutex.Unlock()

f, err := os.Open(fileName)
if err != nil {
logrus.Errorf("error opening validator names file %v: %v", fileName, err)
return fmt.Errorf("error opening validator names file %v: %v", fileName, err)
}

namesYaml := map[string]string{}
decoder := yaml.NewDecoder(f)
err = decoder.Decode(&namesYaml)
if err != nil {
logrus.Errorf("error decoding validator names file %v: %v", fileName, err)
return fmt.Errorf("error decoding validator names file %v: %v", fileName, err)
}

Expand Down

0 comments on commit ce599e2

Please sign in to comment.