diff options
| author | Loyalsoldier <[email protected]> | 2024-08-31 12:34:38 +0800 |
|---|---|---|
| committer | Loyalsoldier <[email protected]> | 2024-08-31 12:34:38 +0800 |
| commit | 1e4cb746b9ca67b9d9dabdc65f42f495eb4cfbcd (patch) | |
| tree | ee3de1a60416c7f56dcc99a2cf7715b9b8f4e5a2 /plugin/maxmind/country_csv.go | |
| parent | deff06ac0f59751bb9857bc7d645b756b6133ddf (diff) | |
Chore: make error messages consistent across formats
Diffstat (limited to 'plugin/maxmind/country_csv.go')
| -rw-r--r-- | plugin/maxmind/country_csv.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plugin/maxmind/country_csv.go b/plugin/maxmind/country_csv.go index 090de13a..eb538dec 100644 --- a/plugin/maxmind/country_csv.go +++ b/plugin/maxmind/country_csv.go @@ -123,7 +123,7 @@ func (g *geoLite2CountryCSV) Input(container lib.Container) (lib.Container, erro } if len(entries) == 0 { - return nil, fmt.Errorf("❌ [type %s | action %s] no entry is generated", typeCountryCSV, g.Action) + return nil, fmt.Errorf("❌ [type %s | action %s] no entry is generated", g.Type, g.Action) } var ignoreIPType lib.IgnoreIPOption @@ -176,7 +176,7 @@ func (g *geoLite2CountryCSV) getCountryCode() (map[string]string, error) { ccMap := make(map[string]string) for _, line := range lines[1:] { if len(line) < 5 { - return nil, fmt.Errorf("❌ [type %s | action %s] invalid record: %v", typeCountryCSV, g.Action, line) + return nil, fmt.Errorf("❌ [type %s | action %s] invalid record: %v", g.Type, g.Action, line) } id := strings.TrimSpace(line[0]) @@ -193,7 +193,7 @@ func (g *geoLite2CountryCSV) getCountryCode() (map[string]string, error) { } if len(ccMap) == 0 { - return nil, fmt.Errorf("❌ [type %s | action %s] invalid country code data", typeCountryCSV, g.Action) + return nil, fmt.Errorf("❌ [type %s | action %s] invalid country code data", g.Type, g.Action) } return ccMap, nil @@ -201,7 +201,7 @@ func (g *geoLite2CountryCSV) getCountryCode() (map[string]string, error) { func (g *geoLite2CountryCSV) process(file string, ccMap map[string]string, entries map[string]*lib.Entry) error { if len(ccMap) == 0 { - return fmt.Errorf("❌ [type %s | action %s] invalid country code data", typeCountryCSV, g.Action) + return fmt.Errorf("❌ [type %s | action %s] invalid country code data", g.Type, g.Action) } if entries == nil { entries = make(map[string]*lib.Entry, len(ccMap)) @@ -234,7 +234,7 @@ func (g *geoLite2CountryCSV) process(file string, ccMap map[string]string, entri } if len(record) < 4 { - return fmt.Errorf("❌ [type %s | action %s] invalid record: %v", typeCountryCSV, g.Action, record) + return fmt.Errorf("❌ [type %s | action %s] invalid record: %v", g.Type, g.Action, record) } ccID := "" |
