From bc6f5ac8adc51861ead3b08c59eaca6b53c4eaf2 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Sun, 3 Nov 2024 21:53:42 +0000 Subject: [PATCH] chore(exchanger): add round trip duration to error message --- internal/exchanger/exchanger.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/exchanger/exchanger.go b/internal/exchanger/exchanger.go index bf5897e2..2a7e83d5 100644 --- a/internal/exchanger/exchanger.go +++ b/internal/exchanger/exchanger.go @@ -31,7 +31,7 @@ func (e *Exchanger) Exchange(ctx context.Context, network string, request *dns.M } dnsConn := &dns.Conn{Conn: netConn} - response, _, err = e.client.ExchangeWithConnContext(ctx, request, dnsConn) + response, roundTripDuration, err := e.client.ExchangeWithConnContext(ctx, request, dnsConn) closeErr := dnsConn.Close() if closeErr != nil { @@ -39,8 +39,8 @@ func (e *Exchanger) Exchange(ctx context.Context, network string, request *dns.M } if err != nil { - return nil, fmt.Errorf("exchanging over %s connection for request %s: %w", - e.dialer, extractRequestQuestion(request), err) + return nil, fmt.Errorf("exchanging over %s connection (%s) for request %s: %w", + e.dialer, roundTripDuration, extractRequestQuestion(request), err) } return response, nil