@@ -43,11 +43,17 @@ func (c *Conn) Exec(ctx context.Context, sql string, params *params.Params) (
4343 result driver.Result , finalErr error ,
4444) {
4545 if ! c .IsValid () {
46- return nil , xerrors .WithStackTrace (errNotReadyConn )
46+ return nil , xerrors .WithStackTrace (xerrors .Retryable (errNotReadyConn ,
47+ xerrors .Invalid (c ),
48+ xerrors .Invalid (c .session ),
49+ ))
4750 }
4851
4952 if ! c .isReady () {
50- return nil , xerrors .WithStackTrace (errNotReadyConn )
53+ return nil , xerrors .WithStackTrace (xerrors .Retryable (errNotReadyConn ,
54+ xerrors .Invalid (c ),
55+ xerrors .Invalid (c .session ),
56+ ))
5157 }
5258
5359 opts := []options.Execute {
@@ -70,11 +76,10 @@ func (c *Conn) Query(ctx context.Context, sql string, params *params.Params) (
7076 result driver.RowsNextResultSet , finalErr error ,
7177) {
7278 if ! c .isReady () {
73- return nil , xerrors .WithStackTrace (errNotReadyConn )
74- }
75-
76- if ! c .isReady () {
77- return nil , xerrors .WithStackTrace (errNotReadyConn )
79+ return nil , xerrors .WithStackTrace (xerrors .Retryable (errNotReadyConn ,
80+ xerrors .Invalid (c ),
81+ xerrors .Invalid (c .session ),
82+ ))
7883 }
7984
8085 opts := []options.Execute {
@@ -155,11 +160,17 @@ func (c *Conn) IsValid() bool {
155160
156161func (c * Conn ) Ping (ctx context.Context ) (finalErr error ) {
157162 if ! c .isReady () {
158- return xerrors .WithStackTrace (errNotReadyConn )
163+ return xerrors .WithStackTrace (xerrors .Retryable (errNotReadyConn ,
164+ xerrors .Invalid (c ),
165+ xerrors .Invalid (c .session ),
166+ ))
159167 }
160168
161169 if ! c .session .IsAlive () {
162- return xerrors .WithStackTrace (errNotReadyConn )
170+ return xerrors .WithStackTrace (xerrors .Retryable (errNotReadyConn ,
171+ xerrors .Invalid (c ),
172+ xerrors .Invalid (c .session ),
173+ ))
163174 }
164175
165176 err := c .session .Exec (ctx , "select 1" )
@@ -178,7 +189,10 @@ func (c *Conn) BeginTx(ctx context.Context, txOptions driver.TxOptions) (common.
178189
179190func (c * Conn ) Close () (finalErr error ) {
180191 if ! c .closed .CompareAndSwap (false , true ) {
181- return xerrors .WithStackTrace (errConnClosedEarly )
192+ return xerrors .WithStackTrace (xerrors .Retryable (errConnClosedEarly ,
193+ xerrors .Invalid (c ),
194+ xerrors .Invalid (c .session ),
195+ ))
182196 }
183197
184198 defer func () {
0 commit comments