// private methods
        private void AddErrorLabelIfRequired(Exception exception, SemanticVersion serverVersion)
        {
            if (exception is MongoException mongoException)
            {
                if (ShouldAddTransientTransactionError(mongoException))
                {
                    mongoException.AddErrorLabel("TransientTransactionError");
                }

                if (RetryabilityHelper.IsCommandRetryable(_command))
                {
                    RetryabilityHelper.AddRetryableWriteErrorLabelIfRequired(mongoException, serverVersion);
                }
            }
        }
        // private methods
        private void AddErrorLabelIfRequired(Exception exception, int?maxWireVersion)
        {
            if (exception is MongoException mongoException)
            {
                if (ShouldAddTransientTransactionError(mongoException))
                {
                    mongoException.AddErrorLabel("TransientTransactionError");
                }

                if (RetryabilityHelper.IsCommandRetryable(_command) && maxWireVersion.HasValue)
                {
                    RetryabilityHelper.AddRetryableWriteErrorLabelIfRequired(mongoException, maxWireVersion.Value);
                }
            }
        }