1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-06 09:15:37 -05:00

simplify error creation

This commit is contained in:
Darien Raymond
2018-09-30 18:39:53 +02:00
parent 00ea6e3cb2
commit d55fbd7f8d
48 changed files with 208 additions and 87 deletions

View File

@@ -2,6 +2,8 @@ package blackhole
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "Blackhole")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View File

@@ -2,6 +2,8 @@ package dokodemo
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "Dokodemo")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View File

@@ -2,6 +2,8 @@ package freedom
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "Freedom")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View File

@@ -2,4 +2,8 @@ package http
import "v2ray.com/core/common/errors"
func newError(values ...interface{}) *errors.Error { return errors.New(values...).Path("Proxy", "HTTP") }
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View File

@@ -2,6 +2,8 @@ package mtproto
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "MTProto")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View File

@@ -2,6 +2,8 @@ package shadowsocks
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "Shadowsocks")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View File

@@ -2,6 +2,8 @@ package socks
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "Socks")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View File

@@ -2,6 +2,8 @@ package encoding
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "VMess", "Encoding")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View File

@@ -2,6 +2,8 @@ package vmess
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "VMess")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View File

@@ -2,6 +2,8 @@ package inbound
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "VMess", "Inbound")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}

View File

@@ -2,6 +2,8 @@ package outbound
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "VMess", "Outbound")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}