exception

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK                     = iota
	DIRPC_UNKNOW_EXCEPTION = 1
)
View Source
const (
	// DIRPC transport/conn exception 10xxx
	DIRPC_CONNECTION_GET_FAIL = 10001 + iota
	DIRPC_RPC_ALLADDR_FAIL
	DIRPC_CALL_CONN_NOT_OPEN
	DIRPC_CALL_WRITE_ERROR
	DIRPC_CALL_READ_ERROR
	DIRPC_TRANSPORT_ERROR
	DIRPC_TRANSPORT_CREATE_ERROR
	DIRPC_SOCKET_BAD_ADDR
	DIRPC_SOCKET_NOT_OPEN
	DIRPC_SOCKET_ALREAD_OPEN
	DIRPC_SOCKET_TIME_OUT
	DIRPC_SOCKET_EOF
	DIRPC_PROTOCOL_FACTORY_CREATE_ERROR
	DIRPC_GET_TRANSPORT_ERROR
)
View Source
const (
	// DIRPC client exception 11xxx
	DIRPC_SETUP_ERROR = 11001 + iota
	DIRPC_CONFIG_GET_ERROR
	DIRPC_THRIFT_CLIENT_CREATE_ERROR
	DIRPC_HTTP_CLIENT_CREATE_ERROR
	DIRPC_INVALID_MODULE_NAME
	DIRPC_INVALID_SERVICE_CONFIG
	DIRPC_HTTP_REQUEST_FAIL
	DIRPC_HTTP_CREATE_REQUEST_ERROR
	DIRPC_THRIFT_NEW_TRANSPORT_ERROR
	DIRPC_CONFIG_UPDATE_ERROR
	DIRPC_GRPC_INVOKE_FAIL
	DIRPC_FUSING_ERROR // 熔断错误码
	DIRPC_HTTP_GETCAFILE_ERROR
	DIRPC_HTTP_SCHEME_ERROR
	DIRPC_INTERCEPTOR_ERROR // 拦截器错误码
	DIRPC_INVOKE_MOCK_ERROR
	DIRPC_MESH_REQUEST_ERROR
	DIRPC_MESH_RESPONSE_ERROR
	DIRPC_MESH_CONN_ERROR
)
View Source
const (
	// DIRPC service exception 12xxx
	DIRPC_INVLAID_SU = 12001 + iota
	DIRPC_SERVICE_REGISTER_ERROR
	DIRPC_SERVICE_STOPED
	DIRPC_SERVICE_GET_FAIL
	DIRPC_SERVICE_NEW_ERROR
	DIRPC_SERVICE_GETCONN_ERROR
)
View Source
const (
	// DIRPC naming exception 13xxx
	DIRPC_NAMING_REGISTER_ERROR = 13001 + iota
	DIRPC_NAMING_RESOLVE_ERROR
)
View Source
const (
	DIRPC_BALANCE_SELECT_ERROR = 14001 + iota
	DIRPC_INVALID_HTTP_REQ
	DIRPC_MESH_PARSEHIJACKADDR_ERROR
	DIRPC_MESHDEGRADE_ERROR
)
View Source
const (
	DIRPC_ADDRMANAGER_NEW_ERROR = 15001 + iota
	DIRPC_ADDRMANAGER_NOTIFY_ERROR
	DIRPC_ADDRMANAGER_UPDATEADDR_ERROR
	DIRPC_ADDRMANAGER_INIT_BALANCER_ERROR
)
View Source
const (
	DIRPC_POOLMANAGER_NEW_ERROR = 16001 + iota
	DIRPC_POOL_CLOSED_ERROR
	DIRPC_POOL_OPENED_ERROR
	DIRPC_POOL_DIAL_ERROR
)
View Source
const (
	// DIRPC internal exception 19xxx
	DIRPC_INTERNAL_VOTE_ERROR = 19001 + iota
	DIRPC_INTERNAL_UPDATENAMING_ERROR
	DIRPC_INTERNAL_TRIGGER_MINUSABLE
	DIRPC_INTERNAL_CONNPOOL_ERROR
	DIRPC_INTERNAL_PANIC
	DIRPC_NOT_SETUP_ERROR

	DIRPC_INTERNAL_DEBUG = 19999
)
View Source
const (
	DIRPC_CIRCUIT_ERROR = 22001 + iota
)
View Source
const (
	DIRPC_HEALTH_CHECK_ERROR = 21001 + iota
)
View Source
const (
	DIRPC_SEND_METRIC_ERROR = 20001 + iota
)

Variables

This section is empty.

Functions

func IsCaredErrorForMesh

func IsCaredErrorForMesh(err error) bool

func IsCaredNetError

func IsCaredNetError(err error) bool

func WithMessage

func WithMessage(err error, message string) error

WithMessage 累加错误信息, 并返回新的error对象. 如果err的类型不是TTransportException, TProtocolException, TApplicationException , 则创建对应的TDirpcException对象

func WithMessagef

func WithMessagef(err error, format string, args ...interface{}) error

Types

type TDirpcException

type TDirpcException interface {
	thrift.TException
	TypeId() int
	DirpcType()
}

func NewDirpcException

func NewDirpcException(errType int, message string) TDirpcException

func NewDirpcExceptionf

func NewDirpcExceptionf(errType int, format string, args ...interface{}) TDirpcException

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL