当前位置: 首页>>代码示例>>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;未经允许,请勿转载。