From 14176a340d581b7d52eed945295864638f7e79db Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Thu, 18 Jan 2018 11:35:04 +0100 Subject: [PATCH] fix error usage --- proxy/vmess/account.go | 3 +-- proxy/vmess/inbound/inbound.go | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/proxy/vmess/account.go b/proxy/vmess/account.go index 44c2908dc..57cc1c5a3 100644 --- a/proxy/vmess/account.go +++ b/proxy/vmess/account.go @@ -31,8 +31,7 @@ func (a *InternalAccount) Equals(account protocol.Account) bool { func (a *Account) AsAccount() (protocol.Account, error) { id, err := uuid.ParseString(a.Id) if err != nil { - newError("failed to parse ID").Base(err).AtError().WriteToLog() - return nil, err + return nil, newError("failed to parse ID").Base(err).AtError() } protoID := protocol.NewID(id) return &InternalAccount{ diff --git a/proxy/vmess/inbound/inbound.go b/proxy/vmess/inbound/inbound.go index 5021fd5b8..df30ae4f9 100644 --- a/proxy/vmess/inbound/inbound.go +++ b/proxy/vmess/inbound/inbound.go @@ -185,7 +185,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection i Status: log.AccessRejected, Reason: err, }) - newError("invalid request from ", connection.RemoteAddr(), ": ", err).AtInfo().WriteToLog() + err = newError("invalid request from ", connection.RemoteAddr()).Base(err).AtInfo() } return err } @@ -252,7 +252,7 @@ func (h *Handler) generateCommand(ctx context.Context, request *protocol.Request if h.inboundHandlerManager != nil { handler, err := h.inboundHandlerManager.GetHandler(ctx, tag) if err != nil { - newError("failed to get detour handler: ", tag, err).AtWarning().WriteToLog() + newError("failed to get detour handler: ", tag).Base(err).AtWarning().WriteToLog() return nil } proxyHandler, port, availableMin := handler.GetRandomInboundProxy()