1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-04 08:15:21 -05:00

update error messages

This commit is contained in:
Darien Raymond
2017-04-06 22:17:13 +02:00
parent b4cd497abf
commit 2668954c12
5 changed files with 25 additions and 24 deletions

View File

@@ -14,7 +14,7 @@ var (
func RegisterTransportListener(protocol TransportProtocol, listener ListenFunc) error {
if _, found := transportListenerCache[protocol]; found {
return errors.New("Internet|TCPHub: ", protocol, " listener already registered.")
return errors.New(protocol, " listener already registered.").AtError().Path("Transport", "Internet")
}
transportListenerCache[protocol] = listener
return nil
@@ -44,11 +44,11 @@ func ListenTCP(ctx context.Context, address v2net.Address, port v2net.Port, conn
}
listenFunc := transportListenerCache[protocol]
if listenFunc == nil {
return nil, errors.New("Internet|TCPHub: ", protocol, " listener not registered.")
return nil, errors.New(protocol, " listener not registered.").AtError().Path("Transport", "Internet")
}
listener, err := listenFunc(ctx, address, port, conns)
if err != nil {
return nil, errors.New("failed to listen on address: ", address, ":", port).Base(err).Path("Internet", "TCPHub")
return nil, errors.New("failed to listen on address: ", address, ":", port).Base(err).Path("Transport", "Internet")
}
return listener, nil
}