本文整理汇总了C#中ErrorHandler.HandleError方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorHandler.HandleError方法的具体用法?C# ErrorHandler.HandleError怎么用?C# ErrorHandler.HandleError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler.HandleError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ErrorHandler
Expression IContractDeserializer.ParseContract (MethodContract mc, string text, ErrorNodeList errs)
{
Expression expression = null;
currentMethodContract = mc;
currentMethod = null;
currentType = null;
if (mc != null){
currentMethod = mc.DeclaringMethod;
currentType = currentMethod.DeclaringType;
}
try{
Parser.ParseContract(this.assembly, text, out expression);
}catch (Exception e){
ErrorNodeList eList = errs != null ? errs : this.ErrorList;
if (eList != null){
#if OLDERRORS
ErrorHandler eh = new ErrorHandler(eList);
eh.HandleError(mc,System.Compiler.Error.GenericError,"Deserializer error: " + e.Message);
#else
this.assembly.MetadataImportErrors.Add(e);
#endif
}
throw e;
}
return expression;
}
示例2: HandleErrorShouldCallBasicPublishWithSuppliedArguments
public void HandleErrorShouldCallBasicPublishWithSuppliedArguments()
{
SetupRabbitMqFactoryDefault();
SetupErrorConfig(true, "errorqueue");
var errorHandler = new ErrorHandler(QueueEndpointProvider, RabbitMqFactory, ChannelConfigurator, RabbitMqLogger.NullLogger);
errorHandler.HandleError(_message, "testendpoint");
Model.AssertWasCalled(x => x.BasicPublish(string.Empty, QueueEndpoint.Subscription.ErrorHandling.ErrorQueueName, Properties, MessageData));
}
示例3: ImplicitNonNullCoercion
/// <summary>
/// This method only performs the non-null coercion, no other type coercions
/// </summary>
public Expression ImplicitNonNullCoercion(ErrorHandler handler, Expression source, TypeNode targetType) {
if (targetType == null) return null;
Literal lit = source as Literal;
if (lit != null && lit.Value == null) {
// will always fail. Emit error.
if (handler != null) { handler.HandleError(source, Error.CannotCoerceNullToNonNullType); }
// turn into explicit coercion so nonnull checker will stay quiet
return ExplicitNonNullCoercion(source, targetType);
}
TypeNode strippedSourceType = TypeNode.StripModifier(source.Type, SystemTypes.NonNullType);
Method testMethod;
if (targetType.IsPointerType) {
testMethod = SystemTypes.NonNullType.GetMethod(Identifier.For("AssertNotNullImplicit"), SystemTypes.UIntPtr);
}
else if (this.useGenerics) {
testMethod = GetGenericAssertNotNullImplicitMethod(strippedSourceType);
}
else
{
testMethod = SystemTypes.NonNullType.GetMethod(Identifier.For("AssertNotNullImplicit"), SystemTypes.Object);
}
return CreateCoercionBlock(source, testMethod, strippedSourceType, targetType);
}
示例4: RunPlugins
public void RunPlugins(Compilation compilation, ErrorHandler errorHandler){
if (this.plugins == null) return;
foreach (Visitor pluginVisitor in this.plugins){
if (pluginVisitor == null){Debug.Assert(false); continue;}
try {
pluginVisitor.Visit(compilation);
}catch(Exception e){
errorHandler.HandleError(compilation, Error.PluginCrash, pluginVisitor.GetType().ToString(), e.Message, e.StackTrace);
}
}
}