当前位置: 首页>>代码示例>>C#>>正文


C# ErrorHandler.HandleError方法代码示例

本文整理汇总了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;
  }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:26,代码来源:DeserializerParser.cs

示例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));
        }
开发者ID:swmal,项目名称:RabbitMQUtil,代码行数:9,代码来源:ErrorHandlerTests.cs

示例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);
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:26,代码来源:TypeSystem.cs

示例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);
     }
   }
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:11,代码来源:Compiler.cs


注:本文中的ErrorHandler.HandleError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。