當前位置: 首頁>>代碼示例>>C#>>正文


C# ApplicationException.ToErrorModel方法代碼示例

本文整理匯總了C#中System.ApplicationException.ToErrorModel方法的典型用法代碼示例。如果您正苦於以下問題:C# ApplicationException.ToErrorModel方法的具體用法?C# ApplicationException.ToErrorModel怎麽用?C# ApplicationException.ToErrorModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.ApplicationException的用法示例。


在下文中一共展示了ApplicationException.ToErrorModel方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: NestedExceptionSignature

        public void NestedExceptionSignature() {
            ApplicationException appEx;

            try {
                throw new Exception("iBland");
            } catch (Exception ex) {
                try {
                    throw new ArgumentException("iThrow", ex);
                } catch (Exception argEx) {
                    appEx = new ApplicationException("iWrap", argEx);
                }
            }

            Error ed = appEx.ToErrorModel();

            var sig = new ErrorSignature(ed, _userNamespaces);

            Assert.Equal("System.Exception", sig.SignatureInfo["ExceptionType"]);
            Assert.Equal("Exceptionless.Tests.Stacking.ErrorSignatureTests.NestedExceptionSignature()", sig.SignatureInfo["Method"]);
        }
開發者ID:khoussem,項目名稱:Exceptionless,代碼行數:20,代碼來源:ErrorSignatureTests.cs

示例2: PopulateFromDeepCallstackException

        public void PopulateFromDeepCallstackException()
        {
            ApplicationException appEx = null;

            try {
                SampleErrors.ThrowExceptionFromSubSubMethod();
            } catch (Exception ex) {
                try {
                    throw new ArgumentException("iThrow", ex);
                } catch (Exception argEx) {
                    appEx = new ApplicationException("iWrap", argEx);
                }
            }

            Assert.NotNull(appEx);

            Error ed = appEx.ToErrorModel();

            Compare(appEx, ed);
        }
開發者ID:arpitgold,項目名稱:Exceptionless,代碼行數:20,代碼來源:ErrorModelTests.cs

示例3: FromDeepCallstackException

        public void FromDeepCallstackException()
        {
            ApplicationException appEx = null;

            try {
                SampleErrors.ThrowExceptionFromSubSubMethod();
            } catch (Exception ex) {
                try {
                    throw new ArgumentException("iThrow", ex);
                } catch (Exception argEx) {
                    appEx = new ApplicationException("iWrap", argEx);
                }
            }

            Assert.NotNull(appEx);

            Error ed = appEx.ToErrorModel();

            var sig = new ErrorSignature(ed);

            Assert.Equal("System.ApplicationException", sig.SignatureInfo["ExceptionType"]);
            Assert.Equal("Samples.SampleErrors.SubMethod()", sig.SignatureInfo["Method"]);
        }
開發者ID:BookSwapSteve,項目名稱:Exceptionless,代碼行數:23,代碼來源:ErrorSignatureTests.cs

示例4: FromLamda

        public void FromLamda()
        {
            ApplicationException appEx = null;

            try {
                SampleErrors.ThrowExceptionFromLambda();
            } catch (Exception ex) {
                try {
                    throw new ArgumentException("iThrow", ex);
                } catch (Exception argEx) {
                    appEx = new ApplicationException("iWrap", argEx);
                }
            }

            Assert.NotNull(appEx);

            Error ed = appEx.ToErrorModel();

            var sig = new ErrorSignature(ed);

            Assert.Equal("System.ApplicationException", sig.SignatureInfo["ExceptionType"]);
            Assert.Equal("Samples.SampleErrors.<ThrowExceptionFromLambda>b__0(String s, Int32 b)", sig.SignatureInfo["Method"]);
        }
開發者ID:BookSwapSteve,項目名稱:Exceptionless,代碼行數:23,代碼來源:ErrorSignatureTests.cs

示例5: PopulateFromNestedException

        public void PopulateFromNestedException() {
            ApplicationException appEx = null;

            try {
                throw new Exception("iBland");
            } catch (Exception ex) {
                try {
                    throw new ArgumentException("iThrow", ex);
                } catch (Exception argEx) {
                    appEx = new ApplicationException("iWrap", argEx);
                }
            }

            Assert.NotNull(appEx);

            Error ed = appEx.ToErrorModel();

            Compare(appEx, ed);
        }
開發者ID:khoussem,項目名稱:Exceptionless,代碼行數:19,代碼來源:ErrorModelTests.cs

示例6: PopulateFromGenericClass

        public void PopulateFromGenericClass() {
            ApplicationException appEx = null;

            try {
                var c = new GenericErrorClass<string, int>();
                c.ThrowFromGenericClass(12);
            } catch (Exception ex) {
                try {
                    throw new ArgumentException("iThrow", ex);
                } catch (Exception argEx) {
                    appEx = new ApplicationException("iWrap", argEx);
                }
            }

            Assert.NotNull(appEx);

            Error ed = appEx.ToErrorModel();

            Compare(appEx, ed);
        }
開發者ID:khoussem,項目名稱:Exceptionless,代碼行數:20,代碼來源:ErrorModelTests.cs

示例7: PopulateFromMethodWithParams

        public void PopulateFromMethodWithParams() {
            ApplicationException appEx = null;

            try {
                SampleErrors.ThrowExceptionFromMethodWithParams("sdfs", 1);
            } catch (Exception ex) {
                try {
                    throw new ArgumentException("iThrow", ex);
                } catch (Exception argEx) {
                    appEx = new ApplicationException("iWrap", argEx);
                }
            }

            Assert.NotNull(appEx);

            Error ed = appEx.ToErrorModel();

            Compare(appEx, ed);
        }
開發者ID:khoussem,項目名稱:Exceptionless,代碼行數:19,代碼來源:ErrorModelTests.cs


注:本文中的System.ApplicationException.ToErrorModel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。