Skip to content

Commit

Permalink
RUBY-3571 Add TransientTransactionError label to PoolClearedError
Browse files Browse the repository at this point in the history
  • Loading branch information
comandeo-mongo committed Oct 31, 2024
1 parent 1db1244 commit 9ca5d7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/mongo/error/pool_cleared_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class PoolClearedError < PoolError
#
# @api private
def initialize(address, pool)
add_label('TransientTransactionError')
super(address, pool,
"Connection to #{address} interrupted due to server monitor timeout " +
"(for pool 0x#{pool.object_id})")
Expand Down
15 changes: 15 additions & 0 deletions spec/mongo/error/pool_cleared_error_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

require 'lite_spec_helper'

describe Mongo::Error::PoolClearedError do
describe '#initialize' do
let(:error) do
described_class.new(double('address'), double('pool'))
end

it 'appends TransientTransactionError' do
expect(error.labels).to include('TransientTransactionError')
end
end
end

0 comments on commit 9ca5d7d

Please sign in to comment.