Use correct log level for CheckCanonicalDomain

- Currently any error generated by requesting the `.domains` file of a
repository would be logged under the info log level, which isn't the
correct log level when we exclude the not found error.
- Use warn log level if the error isn't the not found error.
This commit is contained in:
Gusted 2023-01-22 19:41:30 +01:00
parent bd538abd37
commit 13f71b4dd8
No known key found for this signature in database
GPG key ID: FD821B732837125F

View file

@ -45,7 +45,11 @@ func (o *Options) CheckCanonicalDomain(giteaClient *gitea.Client, actualDomain,
}
}
} else {
log.Info().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo)
if err != gitea.ErrorNotFound {
log.Error().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo)
} else {
log.Info().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo)
}
}
domains = append(domains, o.TargetOwner+mainDomainSuffix)
if domains[len(domains)-1] == actualDomain {