本文整理匯總了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);
}