private static void ParseExceptionMessage(Exception linkSubmissionException, LinkChangeAction action, out string scopeHint, out string conflictDetails)
        {
            /*
             * Example Exception:
             * System.Web.Services.Protocols.SoapException
             *
             * Example Message
             * AddLink: The specified link type requires that work items have a single parent.
             * The target work item already has a parent of that type: %SourceID="969";%, %TargetID="967";%, %LinkType="2";%
             * ---> AddLink: The specified link type requires that work items have a single parent. The target work item already
             * has a parent of that type: %SourceID="969";%, %TargetID="967";%, %LinkType="2";%
             */
            Debug.Assert(linkSubmissionException is System.Web.Services.Protocols.SoapException,
                         "linkSubmissionException is not System.Web.Services.Protocols.SoapException");
            Debug.Assert(!string.IsNullOrEmpty(linkSubmissionException.Message), "linkSubmissionException.Message is null or empty");
            Debug.Assert(linkSubmissionException.Message.StartsWith(SingleParentViolationMessage, StringComparison.OrdinalIgnoreCase),
                         string.Format("linkSubmissionException.Message does not start with '{0}'", SingleParentViolationMessage));

            string sourceItem = action.Link.SourceArtifactId;
            string targetItem = TfsWorkItemHandler.IdFromUri(action.Link.TargetArtifact.Uri);
            string linkType   = action.Link.LinkType.ReferenceName;

            scopeHint       = string.Format("/{0}/{1}/{2}", linkType, sourceItem, targetItem);
            conflictDetails = InvalidWorkItemLinkDetails.CreateConflictDetails(sourceItem, targetItem, linkType);
        }
Beispiel #2
0
        private static void ParseExceptionMessage(
            Exception linkSubmissionException,
            LinkChangeAction action,
            out string scopeHint,
            out string conflictDetails)
        {
            /*
             * Example Exception:
             * System.Web.Services.Protocols.SoapException
             *
             * Example Message
             * Failed to modify links. The following linked work items have been locked by an administrator:
             * %LinkFailures="1954;1955;2;2,";% ---> Failed to modify links. The following linked work items
             * have been locked by an administrator: %LinkFailures="1954;1955;2;2,";%
             */
            Debug.Assert(linkSubmissionException is System.Web.Services.Protocols.SoapException,
                         "linkSubmissionException is not System.Web.Services.Protocols.SoapException");
            Debug.Assert(!string.IsNullOrEmpty(linkSubmissionException.Message), "linkSubmissionException.Message is null or empty");
            Debug.Assert(linkSubmissionException.Message.StartsWith(ModifyLockedWorkItemLinkViolationMessage, StringComparison.OrdinalIgnoreCase),
                         string.Format("linkSubmissionException.Message does not start with '{0}'", ModifyLockedWorkItemLinkViolationMessage));

            string sourceItem = action.Link.SourceArtifactId;
            string targetItem = TfsWorkItemHandler.IdFromUri(action.Link.TargetArtifact.Uri);
            string linkType   = action.Link.LinkType.ReferenceName;

            scopeHint       = string.Format("/{0}/{1}/{2}", linkType, sourceItem, targetItem);
            conflictDetails = InvalidWorkItemLinkDetails.CreateConflictDetails(sourceItem, targetItem, linkType);
        }
Beispiel #3
0
        private static void ParseExceptionMessage(
            Exception linkSubmissionException,
            LinkChangeAction action,
            out string scopeHint,
            out string conflictDetails)
        {
            Debug.Assert(linkSubmissionException is System.Web.Services.Protocols.SoapException,
                         "linkSubmissionException is not System.Web.Services.Protocols.SoapException");

            string sourceItem = action.Link.SourceArtifactId;
            string targetItem = TfsWorkItemHandler.IdFromUri(action.Link.TargetArtifact.Uri);
            string linkType   = action.Link.LinkType.ReferenceName;

            scopeHint       = string.Format("/{0}/{1}/{2}", linkType, sourceItem, targetItem);
            conflictDetails = InvalidWorkItemLinkDetails.CreateConflictDetails(sourceItem, targetItem, linkType);
        }
        private static void ParseExceptionMessage(
            Exception linkSubmissionException,
            LinkChangeAction action,
            out string scopeHint,
            out string conflictDetails)
        {
            Debug.Assert(linkSubmissionException is System.Web.Services.Protocols.SoapException,
                         "linkSubmissionException is not System.Web.Services.Protocols.SoapException");
            Debug.Assert(!string.IsNullOrEmpty(linkSubmissionException.Message), "linkSubmissionException.Message is null or empty");
            Debug.Assert(
                linkSubmissionException.Message.StartsWith(LinkAccessViolationMessage1, StringComparison.OrdinalIgnoreCase) ||
                linkSubmissionException.Message.StartsWith(LinkAccessViolationMessage2, StringComparison.OrdinalIgnoreCase),
                string.Format("linkSubmissionException.Message does not start with '{0}' or '{1}'",
                              LinkAccessViolationMessage1, LinkAccessViolationMessage2));

            string sourceItem = action.Link.SourceArtifactId;
            string targetItem = TfsWorkItemHandler.IdFromUri(action.Link.TargetArtifact.Uri);
            string linkType   = action.Link.LinkType.ReferenceName;

            scopeHint       = string.Format("/{0}/{1}/{2}", linkType, sourceItem, targetItem);
            conflictDetails = InvalidWorkItemLinkDetails.CreateConflictDetails(sourceItem, targetItem, linkType);
        }