diff --git a/common/errors/errors.go b/common/errors/errors.go index bea455cc0..487d79a12 100644 --- a/common/errors/errors.go +++ b/common/errors/errors.go @@ -37,7 +37,9 @@ func (err *Error) pkgPath() string { if err.pathObj == nil { return "" } - return reflect.TypeOf(err.pathObj).PkgPath() + // remove v2ray.com/core/ + oldPath := reflect.TypeOf(err.pathObj).PkgPath() + return strings.Join(strings.Split(oldPath, "/")[2:], "/") } // Error implements error.Error(). diff --git a/common/errors/errors_test.go b/common/errors/errors_test.go index b8228a1e1..1fe240437 100644 --- a/common/errors/errors_test.go +++ b/common/errors/errors_test.go @@ -46,11 +46,11 @@ func TestErrorMessage(t *testing.T) { }{ { err: New("a").Base(New("b")).WithPathObj(e{}), - msg: "v2ray.com/core/common/errors_test: a > b", + msg: "common/errors_test: a > b", }, { err: New("a").Base(New("b").WithPathObj(e{})), - msg: "a > v2ray.com/core/common/errors_test: b", + msg: "a > common/errors_test: b", }, }