fix: capture error correctly in withConn

This commit is contained in:
Dom Parfitt 2022-11-01 21:09:37 +00:00
parent f1d6bc91b7
commit d1bfaba549
1 changed files with 3 additions and 5 deletions

View File

@ -288,11 +288,9 @@ func (c *baseClient) withConn(
return err
}
defer func() {
c.releaseConn(ctx, cn, err)
}()
return fn(ctx, cn)
err = fn(ctx, cn)
c.releaseConn(ctx, cn, err)
return err
}
func (c *baseClient) dial(ctx context.Context, network, addr string) (net.Conn, error) {