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


C# ErrorHandler类代码示例

本文整理汇总了C#中ErrorHandler的典型用法代码示例。如果您正苦于以下问题:C# ErrorHandler类的具体用法?C# ErrorHandler怎么用?C# ErrorHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ErrorHandler类属于命名空间,在下文中一共展示了ErrorHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SocketClient

		/// <summary> 
		/// Constructor for client support
		/// </summary>
		/// <param name="sizeOfRawBuffer"> The size of the raw buffer </param>
		/// <param name="userArg"> A Reference to the Users arguments </param>
		/// <param name="messageHandler">  Reference to the user defined message handler method </param>
		/// <param name="closeHandler">  Reference to the user defined close handler method </param>
		/// <param name="errorHandler">  Reference to the user defined error handler method </param>
		public SocketClient(int sizeOfRawBuffer, object userArg, 
			MessageHandler messageHandler, CloseHandler closeHandler, 
			ErrorHandler errorHandler, ConnectHandler connectHandler)
		{
			// Create the raw buffer
			this.SizeOfRawBuffer = sizeOfRawBuffer;
			this.RawBuffer  = new Byte[this.SizeOfRawBuffer];

			// Save the user argument
			this.userArg = userArg;

			// Set the handler methods
			this.messageHandler = messageHandler;
			this.closeHandler = closeHandler;
			this.errorHandler = errorHandler;
            this.connectHandler = connectHandler;

			// Set the async socket method handlers
			this.callbackReadMethod  = new AsyncCallback(ReceiveComplete);
			this.callbackWriteMethod = new AsyncCallback(SendComplete);
            this.callbackWriteHeadMethod = new AsyncCallback(SendHead);

			this.m_Connected = true;
			// Init the dispose flag
			this.disposed = false;
		}
开发者ID:kingstop,项目名称:crashmo,代码行数:34,代码来源:SocketClient.cs

示例3: ApplyDispatchBehavior

        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            var eh=new ErrorHandler();

            foreach (ChannelDispatcherBase cdb in serviceHostBase.ChannelDispatchers)
                ((ChannelDispatcher)cdb).ErrorHandlers.Insert(0, eh);
        }
开发者ID:mcartoixa,项目名称:GeoSIK,代码行数:7,代码来源:FaultBehavior.cs

示例4: DoSemanticChecks

 public override void DoSemanticChecks(ErrorHandler errs, Scope currentScope)
 {
     foreach (AstNode astNode in _content)
     {
         astNode.DoSemanticChecks(errs, currentScope);
     }
 }
开发者ID:jonorossi,项目名称:cvsi,代码行数:7,代码来源:XmlAttribute.cs

示例5: rankingTops

        public static void rankingTops(String token, String list_id, int count, int start_row, String time_type, String relation_type, YebobHandler handler, ErrorHandler onError)
        {
            String url = String.Format("{0}/ranking/tops?list_id={1}&count={2}&start_row={3}&time_type={4}&relation_type={5}",
                URL_PREFIX, list_id, count, start_row, time_type, relation_type);

            getWithToken(token, url, handler, onError);
        }
开发者ID:lite,项目名称:yebob_wp,代码行数:7,代码来源:Api.cs

示例6: AwardAchievement

    /// <summary>
    /// Awards an achievement.
    /// </summary>
    /// <param name="achievementName">The name of the achievement to award.</param>
    /// <param name="success">Callback triggers on successful award.</param>
    /// <param name="error">Callback triggers on error.</param>
    public static Coroutine AwardAchievement(string achievementName, SuccessHandler success, ErrorHandler error)
    {
        drWWW www = new drWWW(drAPI.awardAchievement);
        www.AddField("name", achievementName);

        www.OnSuccess += delegate {
            if (!(bool)www.result) { // This should never occur, but the check is here just in case
                drDebug.LogWarning("Did not award achievement \"" + achievementName + "\"");
                return;
            }

            if (!_awardedAchievements.Contains(achievementName)) {
                _awardedAchievements.Add(achievementName);
            }

            drClient.RefreshCanvasComponent(drClient.CanvasComponent.Achievements);
            drDebug.Log("Awarded achievement " + achievementName);
        }; www.OnSuccess += success;

        www.OnError += delegate (string errorMessage) {
            drDebug.LogError("Error awarding achievement \"" + achievementName + "\": " + errorMessage);
        }; www.OnError += error;

        return www.Fetch();
    }
开发者ID:dimerocker,项目名称:Clients,代码行数:31,代码来源:drAchievements.cs

示例7: ApplyDispatchBehavior

        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
        {
            IErrorHandler handler = new ErrorHandler();
            foreach (ChannelDispatcher chDisp in serviceHostBase.ChannelDispatchers)
            {
                if (chDisp.BindingName.Contains("WebHttpBinding"))
                {
                    chDisp.ErrorHandlers.Add(handler);
                    foreach (EndpointDispatcher epDisp in chDisp.Endpoints)
                    {
                        epDisp.DispatchRuntime.MessageInspectors.Add(new Authenticator());
                    }
                }
            }

            foreach (ServiceEndpoint endpoint in serviceDescription.Endpoints)
            {
                if (endpoint.Binding.GetType() == typeof(WebHttpBinding))
                {
                    foreach (OperationDescription operation in endpoint.Contract.Operations)
                    {
                        operation.Behaviors.Add(new CustomMessageFormatter.Behavior());
                    }
                }
            }
        }
开发者ID:MooDevTeam,项目名称:Moo,代码行数:26,代码来源:CustomBehavior.cs

示例8: ParseSource

        public override Microsoft.VisualStudio.Package.AuthoringScope ParseSource(ParseRequest req)
        {
            Babel.Source source = (Babel.Source)this.GetSource(req.FileName);
            bool yyparseResult = false;

            // req.DirtySpan seems to be set even though no changes have occurred
            // source.IsDirty also behaves strangely
            // might be possible to use source.ChangeCount to sync instead

            if (req.DirtySpan.iStartIndex != req.DirtySpan.iEndIndex
                || req.DirtySpan.iStartLine != req.DirtySpan.iEndLine) {
                ErrorHandler handler = new ErrorHandler();
                Scanner scanner = new Scanner(); // string interface
                Parser parser = new Parser();  // use noarg constructor
                parser.scanner = scanner;
                scanner.Handler = handler;
                parser.SetHandler(handler);
                scanner.SetSource(req.Text, 0);

                parser.MBWInit(req);
                yyparseResult = parser.Parse();

                // store the parse results
                // source.ParseResult = aast;
                source.ParseResult = null;
                source.Braces = parser.Braces;

                // for the time being, just pull errors back from the error handler
                if (handler.ErrNum > 0) {
                    foreach (Babel.Parser.Error error in handler.SortedErrorList()) {
                        TextSpan span = new TextSpan();
                        span.iStartLine = span.iEndLine = error.line - 1;
                        span.iStartIndex = error.column;
                        span.iEndIndex = error.column + error.length;
                        req.Sink.AddError(req.FileName, error.message, span, Severity.Error);
                    }
                }
            }
            switch (req.Reason) {
                case ParseReason.Check:
                case ParseReason.HighlightBraces:
                case ParseReason.MatchBraces:
                case ParseReason.MemberSelectAndHighlightBraces:
                    // send matches to sink
                    // this should (probably?) be filtered on req.Line / col
                    if (source.Braces != null) {
                        foreach (TextSpan[] brace in source.Braces) {
                            if (brace.Length == 2)
                                req.Sink.MatchPair(brace[0], brace[1], 1);
                            else if (brace.Length >= 3)
                                req.Sink.MatchTriple(brace[0], brace[1], brace[2], 1);
                        }
                    }
                    break;
                default:
                    break;
            }

            return new AuthoringScope(req.Text);
        }
开发者ID:einaregilsson,项目名称:Process-Language-Runtime,代码行数:60,代码来源:CCSLanguage.cs

示例9: Parser

        public Parser(Scanner scanner, ErrorHandler errors)
        {
            _scanner = scanner;
            _scanner.GetToken();

            _errors = errors;
        }
开发者ID:jonorossi,项目名称:cvsi,代码行数:7,代码来源:Parser.cs

示例10: LoadData

    /// <summary>
    /// Loads data.
    /// </summary>
    /// <param name="success">Callback triggers on successful data load.</param>
    /// <param name="error">Callback triggers on error.</param>
    public static Coroutine LoadData(SuccessHandler success, ErrorHandler error)
    {
        drWWW www = new drWWW(drAPI.loadData);

        www.OnSuccess += delegate {
            Hashtable result = www.result as Hashtable;

            if (result["data"] == null) {
                drDebug.LogWarning("No data exists in the data store to load");
           		return;
            }

            if (data == null) {
                data = new Dictionary<string, object>();
            }

            StoreReturnData(result["data"] as Hashtable);

            drDebug.Log("Loaded data");
        }; www.OnSuccess += success;

        www.OnError += delegate (string errorMessage) {
            drDebug.LogError("Error loading data: " + errorMessage);
        }; www.OnError += error;

        return www.Fetch();
    }
开发者ID:dimerocker,项目名称:Clients,代码行数:32,代码来源:drDataStore.cs

示例11: StartTry

 public static Thread StartTry(MethodInvoker code, ErrorHandler on_error = null, MethodInvoker on_finally = null, bool background = true)
 {
     Thread t = new Thread(
         () => {
             try
             {
                 code.Invoke();
             }
             catch (ThreadAbortException e)
             {
                 Thread.ResetAbort();
             }
             catch (Exception e)
             {
                 if (on_error != null)
                     on_error.Invoke(e);
                 else
                     Message.Error(e);
             }
             finally
             {
                 on_finally?.Invoke();
             }
         }
     );
     t.IsBackground = background;
     t.Start();
     return t;
 }
开发者ID:sergeystoyan,项目名称:CliverBot,代码行数:29,代码来源:ThreadRoutines.cs

示例12: Awake

    new void Awake()
    {
        base.Awake();
        if(smartFox.IsConnected)
        {
            CharacterList = new CharacterListHandler();
            CharacterSelected = new CharacterSelectedHandler();
            errorHandler = new ErrorHandler();

            // Register callback delegate
            smartFox.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost);
            smartFox.AddEventListener(SFSEvent.LOGOUT, OnLogout);

            smartFox.AddLogListener(LogLevel.DEBUG, OnDebugMessage);

            // Personal message handlers
            handlers.Add("characterlist", CharacterList);
            handlers.Add("characterSelected", CharacterSelected);
            handlers.Add("error", errorHandler);

            CharacterList.afterMessageRecieved += AfterCharacterList;
            CharacterSelected.afterMessageRecieved += AfterCharacterSelected;

            // We are ready to get the character list
            new GetCharactersMessage(smartFox, false).Send();

        }
        else
        {
            Application.LoadLevel("Lobby");
        }
    }
开发者ID:Antaresgames,项目名称:AegisBorn,代码行数:32,代码来源:CharacterSelectGUI.cs

示例13: PublishFolderPicker

        public PublishFolderPicker(string destinationName, ErrorHandler errorCallback, string rootPath)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();
            destinationTree.RightToLeftLayout = true;
            this.buttonOK.Text = Res.Get(StringId.OKButtonText);
            this.buttonCancel.Text = Res.Get(StringId.CancelButton);
            this.label1.Text = Res.Get(StringId.PublishFolderPickerCaption);
            this.buttonNewFolder.ButtonText = Res.Get(StringId.NewFolder);
            this.buttonNewFolder.AccessibleName = Res.Get(StringId.NewFolder);
            this.buttonNewFolder.ToolTip = Res.Get(StringId.NewFolderTooltip);
            this.Text = Res.Get(StringId.PublishFolderPickerTitle);

            //set the error handler.
            errorHandler = errorCallback;

            //Root Node
            RootNode = new TreeNode();

            // configure tree
            RootNode.Text = destinationName;
            RootNode.Tag = rootPath;
            destinationTree.Nodes.Add(RootNode);
            destinationTree.SelectedNode = RootNode;
            destinationTree.SelectedNode.ImageIndex = 0;
        }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:26,代码来源:PublishFolderPicker.cs

示例14: this

	public XmlParserInput
				(TextReader reader,
				 XmlNameTable nameTable,
				 ErrorHandler error)
			: this(reader, nameTable, null, error)
			{
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:XmlParserInput.cs

示例15: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
 {
    ErrorHandler handler = new ErrorHandler();
    foreach (ChannelDispatcher dispatcher in serviceHostBase.ChannelDispatchers)
    {
       dispatcher.ErrorHandlers.Add(handler);
    }
 }
开发者ID:ericklombardo,项目名称:Nuaguil.Net,代码行数:8,代码来源:ErrorServiceBehavior.cs


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