From 1e4cb746b9ca67b9d9dabdc65f42f495eb4cfbcd Mon Sep 17 00:00:00 2001 From: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Date: Sat, 31 Aug 2024 12:34:38 +0800 Subject: Chore: make error messages consistent across formats --- plugin/v2ray/dat_in.go | 6 +++--- plugin/v2ray/dat_out.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'plugin/v2ray') diff --git a/plugin/v2ray/dat_in.go b/plugin/v2ray/dat_in.go index 4b2a98c0..96de3d70 100644 --- a/plugin/v2ray/dat_in.go +++ b/plugin/v2ray/dat_in.go @@ -42,7 +42,7 @@ func newGeoIPDatIn(action lib.Action, data json.RawMessage) (lib.InputConverter, } if tmp.URI == "" { - return nil, fmt.Errorf("[type %s | action %s] uri must be specified in config", typeGeoIPdatIn, action) + return nil, fmt.Errorf("❌ [type %s | action %s] uri must be specified in config", typeGeoIPdatIn, action) } // Filter want list @@ -100,7 +100,7 @@ func (g *geoIPDatIn) Input(container lib.Container) (lib.Container, error) { } if len(entries) == 0 { - return nil, fmt.Errorf("❌ [type %s | action %s] no entry is generated", typeGeoIPdatIn, g.Action) + return nil, fmt.Errorf("❌ [type %s | action %s] no entry is generated", g.Type, g.Action) } var ignoreIPType lib.IgnoreIPOption @@ -151,7 +151,7 @@ func (g *geoIPDatIn) walkRemoteFile(url string, entries map[string]*lib.Entry) e defer resp.Body.Close() if resp.StatusCode != 200 { - return fmt.Errorf("failed to get remote file %s, http status code %d", url, resp.StatusCode) + return fmt.Errorf("❌ [type %s | action %s] failed to get remote file %s, http status code %d", g.Type, g.Action, url, resp.StatusCode) } if err := g.generateEntries(resp.Body, entries); err != nil { diff --git a/plugin/v2ray/dat_out.go b/plugin/v2ray/dat_out.go index abb00ca4..771d4e27 100644 --- a/plugin/v2ray/dat_out.go +++ b/plugin/v2ray/dat_out.go @@ -219,7 +219,7 @@ func (g *geoIPDatOut) generateGeoIP(entry *lib.Entry) (*router.GeoIP, error) { }, nil } - return nil, fmt.Errorf("entry %s has no CIDR", entry.GetName()) + return nil, fmt.Errorf("❌ [type %s | action %s] entry %s has no CIDR", g.Type, g.Action, entry.GetName()) } // Sort by country code to make reproducible builds -- cgit v1.3.1