1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-03 15:55:20 -05:00

refactor error messages

This commit is contained in:
Darien Raymond
2017-04-09 01:43:25 +02:00
parent 8175a751db
commit 35248497d2
141 changed files with 710 additions and 481 deletions

View File

@@ -7,18 +7,17 @@ import (
"github.com/gorilla/websocket"
"v2ray.com/core/app/log"
"v2ray.com/core/common"
"v2ray.com/core/common/errors"
v2net "v2ray.com/core/common/net"
"v2ray.com/core/transport/internet"
v2tls "v2ray.com/core/transport/internet/tls"
)
func Dial(ctx context.Context, dest v2net.Destination) (internet.Connection, error) {
log.Trace(errors.New("creating connection to ", dest).Path("Transport", "Internet", "WebSocket"))
log.Trace(newError("creating connection to ", dest))
conn, err := dialWebsocket(ctx, dest)
if err != nil {
return nil, errors.New("dial failed").Path("WebSocket", "Dialer")
return nil, newError("dial failed")
}
return internet.Connection(conn), nil
}
@@ -66,7 +65,7 @@ func dialWebsocket(ctx context.Context, dest v2net.Destination) (net.Conn, error
if resp != nil {
reason = resp.Status
}
return nil, errors.New("failed to dial to (", uri, "): ", reason).Base(err).Path("WebSocket", "Dialer")
return nil, newError("failed to dial to (", uri, "): ", reason).Base(err)
}
return &connection{