本文整理汇总了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"]);
}
示例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);
}
示例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"]);
}
示例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"]);
}
示例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);
}
示例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);
}
示例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);
}