@@ -120,10 +120,13 @@ def make_commit_overload_error
120120 context 'when callback raises TransientTransactionError and retry timeout is exceeded' do
121121 let ( :transient_error ) { make_transient_error }
122122
123- it 'propagates the error as TimeoutError including the transient error message ' do
123+ it 'propagates the error as TimeoutError with the same labels as the wrapped error ' do
124124 with_expired_deadline_after ( initial_calls : 1 ) do
125125 ex = expect { session . with_transaction ( timeout_ms : 1 ) { raise transient_error } }
126- ex . to raise_error ( Mongo ::Error ::TimeoutError ) { |e | expect ( e . message ) . to include ( transient_error . message ) }
126+ ex . to raise_error ( Mongo ::Error ::TimeoutError ) do |e |
127+ expect ( e . message ) . to include ( transient_error . message )
128+ expect ( e . labels ) . to match_array ( transient_error . labels )
129+ end
127130 end
128131 end
129132 end
@@ -133,14 +136,17 @@ def make_commit_overload_error
133136
134137 before { allow ( session ) . to receive ( :commit_transaction ) { raise commit_error } }
135138
136- it 'propagates the error as TimeoutError including the commit error message ' do
139+ it 'propagates the error as TimeoutError with the same labels as the wrapped error ' do
137140 with_expired_deadline_after ( initial_calls : 2 ) do
138141 ex = expect do
139142 session . with_transaction ( timeout_ms : 1 ) do
140143 session . instance_variable_set ( :@state , Mongo ::Session ::TRANSACTION_IN_PROGRESS_STATE )
141144 end
142145 end
143- ex . to raise_error ( Mongo ::Error ::TimeoutError ) { |e | expect ( e . message ) . to include ( commit_error . message ) }
146+ ex . to raise_error ( Mongo ::Error ::TimeoutError ) do |e |
147+ expect ( e . message ) . to include ( commit_error . message )
148+ expect ( e . labels ) . to match_array ( commit_error . labels )
149+ end
144150 end
145151 end
146152 end
@@ -150,14 +156,17 @@ def make_commit_overload_error
150156
151157 before { allow ( session ) . to receive ( :commit_transaction ) { raise commit_error } }
152158
153- it 'propagates the error as TimeoutError including the commit error message ' do
159+ it 'propagates the error as TimeoutError with the same labels as the wrapped error ' do
154160 with_expired_deadline_after ( initial_calls : 2 ) do
155161 ex = expect do
156162 session . with_transaction ( timeout_ms : 1 ) do
157163 session . instance_variable_set ( :@state , Mongo ::Session ::TRANSACTION_IN_PROGRESS_STATE )
158164 end
159165 end
160- ex . to raise_error ( Mongo ::Error ::TimeoutError ) { |e | expect ( e . message ) . to include ( commit_error . message ) }
166+ ex . to raise_error ( Mongo ::Error ::TimeoutError ) do |e |
167+ expect ( e . message ) . to include ( commit_error . message )
168+ expect ( e . labels ) . to match_array ( commit_error . labels )
169+ end
161170 end
162171 end
163172 end
0 commit comments