From 4b8e6c4178aaef3d19d88eb979755fdfc85eb398 Mon Sep 17 00:00:00 2001 From: Sinh Date: Wed, 23 Aug 2023 11:28:30 +0700 Subject: [PATCH] update handle err OR --- partnerapi/tnc/tnc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/partnerapi/tnc/tnc.go b/partnerapi/tnc/tnc.go index 0df0e74..30d1e30 100644 --- a/partnerapi/tnc/tnc.go +++ b/partnerapi/tnc/tnc.go @@ -67,7 +67,6 @@ func (c *Client) CreateOutboundRequest(p OutboundRequestPayload) (*OutboundReque } var ( r model.CommunicationHttpResponse - errRes Error dataRes []OutboundRequestRes ) if err = pjson.Unmarshal(msg.Data, &r); err != nil { @@ -78,6 +77,7 @@ func (c *Client) CreateOutboundRequest(p OutboundRequestPayload) (*OutboundReque return nil, fmt.Errorf("tnc.Client.CreateOutboundRequest: empty_response") } if res.StatusCode >= http.StatusBadRequest { + var errRes Error if err = r.ParseResponseData(&errRes); err != nil { return nil, fmt.Errorf("tnc.Client.CreateOutboundRequest: parse_response_err: %v", err) } @@ -92,7 +92,7 @@ func (c *Client) CreateOutboundRequest(p OutboundRequestPayload) (*OutboundReque item := &dataRes[0] e := item.Error if e != nil { - return nil, errRes + return nil, e } return item, err