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
+3 -1
View File
@@ -2,6 +2,8 @@ package commander
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("App", "Commander")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+3 -1
View File
@@ -2,6 +2,8 @@ package dispatcher
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("App", "Dispatcher")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+5 -1
View File
@@ -2,4 +2,8 @@ package dns
import "v2ray.com/core/common/errors"
func newError(values ...interface{}) *errors.Error { return errors.New(values...).Path("App", "DNS") }
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+3 -1
View File
@@ -2,6 +2,8 @@ package command
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("App", "Log", "Command")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+5 -1
View File
@@ -2,4 +2,8 @@ package log
import "v2ray.com/core/common/errors"
func newError(values ...interface{}) *errors.Error { return errors.New(values...).Path("App", "Log") }
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+5 -1
View File
@@ -2,4 +2,8 @@ package policy
import "v2ray.com/core/common/errors"
func newError(values ...interface{}) *errors.Error { return errors.New(values...).Path("App", "Policy") }
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+3 -1
View File
@@ -2,6 +2,8 @@ package command
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("App", "Proxyman", "Command")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+3 -1
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("App", "Proxyman", "Inbound")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+3 -1
View File
@@ -2,6 +2,8 @@ package mux
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("App", "Proxyman", "Mux")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+3 -1
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("App", "Proxyman", "Outbound")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+5 -1
View File
@@ -2,4 +2,8 @@ package router
import "v2ray.com/core/common/errors"
func newError(values ...interface{}) *errors.Error { return errors.New(values...).Path("App", "Router") }
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+3 -1
View File
@@ -2,6 +2,8 @@ package command
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("App", "Stats", "Command")
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
+5 -1
View File
@@ -2,4 +2,8 @@ package stats
import "v2ray.com/core/common/errors"
func newError(values ...interface{}) *errors.Error { return errors.New(values...).Path("App", "Stats") }
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}