コード例 #1
0
        private static ExceptionContent TryExtractException(
            [CanBeNull] XmlElement exceptionElement,
            [NotNull] PsiLanguageType languageType,
            [NotNull] IPsiModule psiModule)
        {
            string cref = exceptionElement?.GetAttribute("cref");

            if (String.IsNullOrEmpty(cref))
            {
                return(null);
            }

            cref = XmlDocPresenterUtil.ProcessCref(cref);
            if (String.IsNullOrEmpty(cref))
            {
                return(null);
            }

            var exceptionContent = new ExceptionContent(cref);

            if (exceptionElement.HasChildNodes)
            {
                RichText richText = XmlDocRichTextPresenter.Run(exceptionElement, false, languageType, psiModule).RichText;
                if (!richText.IsNullOrEmpty())
                {
                    exceptionContent.Description = richText;
                }
            }
            return(exceptionContent);
        }
コード例 #2
0
 public TransactionResult(CustomException exception, object content = null)
 {
     this.IsSuccessful           = false;
     this.Content                = content;
     this.CustomExceptionMessage = exception.CustomMessage;
     this.ExceptionContent       = exception.Content;
 }
コード例 #3
0
        private static IEnumerable <ExceptionContent> GetExceptions([NotNull] IDeclaredElement element, [NotNull] PsiLanguageType languageType,
                                                                    [NotNull] IPsiModule psiModule, [NotNull] IModuleReferenceResolveContext resolveContext)
        {
            XmlNode xmlDoc = element.GetXMLDoc(true);

            if (xmlDoc == null)
            {
                return(EmptyList <ExceptionContent> .InstanceList);
            }

            XmlNodeList exceptionNodes = xmlDoc.SelectNodes("exception");

            if (exceptionNodes == null || exceptionNodes.Count == 0)
            {
                return(EmptyList <ExceptionContent> .InstanceList);
            }

            var exceptions = new LocalList <ExceptionContent>();

            foreach (XmlNode exceptionNode in exceptionNodes)
            {
                ExceptionContent exceptionContent = TryExtractException(exceptionNode as XmlElement, languageType, psiModule, resolveContext);
                if (exceptionContent != null)
                {
                    exceptions.Add(exceptionContent);
                }
            }
            return(exceptions.ResultingList());
        }
        public IEnumerator ContentProvider_WhenContentThrows_Exits()
        {
            var content = new ExceptionContent();

            LogAssert.Expect(LogType.Error, "SelectionUtilityTests.ExceptionContent: Releasing content named 'Exception' because it threw an exception.");
            LogAssert.Expect(LogType.Exception, "Exception: Why are you doing this?");
            SelectionUtility.ShowInWindow(content);
            for (var i = 0; i < 10; ++i)
            {
                yield return(null);
            }
            Assert.That(Resources.FindObjectsOfTypeAll <ContentWindow>().Any(), Is.False);
        }
コード例 #5
0
        private static IEnumerable <ExceptionContent> GetExceptions(
            [CanBeNull] XmlNode xmlDoc,
            [NotNull] PsiLanguageType languageType,
            [NotNull] IPsiModule psiModule)
        {
            XmlNodeList exceptionNodes = xmlDoc?.SelectNodes("exception");

            if (exceptionNodes == null || exceptionNodes.Count == 0)
            {
                return(EmptyList <ExceptionContent> .InstanceList);
            }

            var exceptions = new LocalList <ExceptionContent>();

            foreach (XmlNode exceptionNode in exceptionNodes)
            {
                ExceptionContent exceptionContent = TryExtractException(exceptionNode as XmlElement, languageType, psiModule);
                if (exceptionContent != null)
                {
                    exceptions.Add(exceptionContent);
                }
            }
            return(exceptions.ResultingList());
        }
コード例 #6
0
 public ExceptionCounter(ExceptionContent content) => Content = content;
コード例 #7
0
 public void OnException(ExceptionContent rc)
 {
     var message = rc.Message;
 }
コード例 #8
0
 public void OnException(ExceptionContent filterContext)
 {
     filterContext.Context.Response.Write(filterContext.Exception.Message);
 }