mongodb/mongoid

View on GitHub
lib/mongoid/errors/transaction_error.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true
# rubocop:todo all

module Mongoid
  module Errors

    # This error is raised when a transaction failed because
    # of an unexpected error.
    class TransactionError < MongoidError

      # Creates the exception.
      #
      # @param [ StandardError ] error Error that caused the
      #   transaction failure.
      def initialize(error)
        super(
          compose_message(
            'transaction_error',
            { error: "#{error.class}: #{error.message}" }
          )
        )
      end
    end
  end
end