Sha256: f46ab1ed6f61e0af14f6cf3cc30299d877c214dd38b637b3c367f40fde4c0221

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

# Copyright (C) 2018-2019 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Mongo
  module Operation

    # Shared behavior of applying transaction error label to execution result.
    #
    # @note This module should be included after ExecutableNoValidate,
    #   if both are included in a class.
    #
    # @api private
    module ExecutableTransactionLabel

      def execute(server)
        super
      rescue Mongo::Error::SocketError => e
        e.send(:add_label, Mongo::Error::TRANSIENT_TRANSACTION_ERROR_LABEL) if session.in_transaction?
        raise e
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongo-2.7.0 lib/mongo/operation/shared/executable_transaction_label.rb
mongo-2.7.0.rc0 lib/mongo/operation/shared/executable_transaction_label.rb