Skip to content

Commit bc6f5ac

Browse files
committed
chore(exchanger): add round trip duration to error message
1 parent 5326983 commit bc6f5ac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/exchanger/exchanger.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ func (e *Exchanger) Exchange(ctx context.Context, network string, request *dns.M
3131
}
3232
dnsConn := &dns.Conn{Conn: netConn}
3333

34-
response, _, err = e.client.ExchangeWithConnContext(ctx, request, dnsConn)
34+
response, roundTripDuration, err := e.client.ExchangeWithConnContext(ctx, request, dnsConn)
3535

3636
closeErr := dnsConn.Close()
3737
if closeErr != nil {
3838
e.warner.Warn("cannot close " + e.dialer.String() + " connection: " + closeErr.Error())
3939
}
4040

4141
if err != nil {
42-
return nil, fmt.Errorf("exchanging over %s connection for request %s: %w",
43-
e.dialer, extractRequestQuestion(request), err)
42+
return nil, fmt.Errorf("exchanging over %s connection (%s) for request %s: %w",
43+
e.dialer, roundTripDuration, extractRequestQuestion(request), err)
4444
}
4545

4646
return response, nil

0 commit comments

Comments
 (0)