/// <summary>
        /// Handles the Error event of the Instance control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.IO.ErrorEventArgs"/> instance containing the event data.</param>
        private void Instance_Error(object sender, ErrorEventArgs e)
        {
            _messages.Add(WebStringHelper.EncodeForWebString(e.Message));
            ErrorMessages.DataSource = _messages;
            ErrorMessages.DataBind();

            Visible = _messages != null && _messages.Count > 0;
        }
 protected void OnError(object sender, ErrorEventArgs args)
 {
     var onError = Error;
     if (onError != null)
     {
         onError(sender, args);
     }
 }
Exemple #3
0
	/// <summary>
	/// Creates the error event.
	/// </summary>
	/// <returns>The error event.</returns>
	/// <param name="code">Code.</param>
	public static IEvent	CreateErrorEvent(int error)
	{
		ErrorEventArgs v = new ErrorEventArgs();
		v.Code = error;

		return new IEvent(
			EngineEventType.EVENT_GLOBAL, CMD_ERROR, v
			);
	}
        public void ErrorEventArgs_ctor_Null()
        {
            ErrorEventArgs args = new ErrorEventArgs(null);

            Assert.Null(args.GetException());

            // Make sure method is consistent.
            Assert.Null(args.GetException());
        }
    private static void ValidateErrorEventArgs(Exception exception)
    {
        ErrorEventArgs args = new ErrorEventArgs(exception);

        Assert.Equal(exception, args.GetException());

        // Make sure method is consistent.
        Assert.Equal(exception, args.GetException());
    }
        public void ErrorEventArgs_ctor()
        {
            Exception exception = new Exception();

            ErrorEventArgs args = new ErrorEventArgs(exception);

            Assert.Equal(exception, args.GetException());

            // Make sure method is consistent.
            Assert.Equal(exception, args.GetException());
        }
        public void OnError(ErrorEventArgs args)
        {
            bool raised = false;
            EventHandler<ErrorEventArgs> handler = (sender, e) => raised = e == args;
            var sut = new ExperimentSteps<string, string>();
            sut.OnErrorEvent += handler;
            sut.OnError(args);

            //Verify
            Assert.True(raised);
        }
 /// <summary>
 /// If this namespace declaration has not yet been initialized, parse the source, set the containing nodes of the result
 /// and report any scanning and parsing errors via the host environment. This method is called whenever 
 /// </summary>
 /// <remarks>Not called in incremental scenarios</remarks>
 protected override void InitializeIfNecessary() {
   if (this.isInitialized) return;
   lock (GlobalLock.LockingObject) {
     if (this.isInitialized) return;
     //^ assume this.CompilationPart is CompilationPart; //The constructor ensures this
     SmallBasicCompilationPart cp = (SmallBasicCompilationPart)this.CompilationPart;
     Parser parser = new Parser(this.Compilation.NameTable, this.SourceLocation, new SmallBasicCompilerOptions(), cp.ScannerAndParserErrors); //TODO: get options from Compilation
     this.Parse(parser);
     this.SetContainingNodes();
     ErrorEventArgs errorEventArguments = new ErrorEventArgs(ErrorReporter.Instance, this.SourceLocation, cp.ScannerAndParserErrors.AsReadOnly());
     this.Compilation.HostEnvironment.ReportErrors(errorEventArguments);
     this.isInitialized = true;
   }
 }
 protected override void InitializeIfNecessary()
   //^^ ensures this.members != null;
 {
   if (this.isInitialized) return;
   lock (GlobalLock.LockingObject) {
     if (this.isInitialized) return;
     //^ assume this.CompilationPart is SpecSharpCompilationPart; //The constructor ensures this
     SpecSharpCompilationPart cp = (SpecSharpCompilationPart)this.CompilationPart;
     Parser parser = new Parser(this.Compilation, this.SourceLocation, cp.ScannerAndParserErrors); //TODO: get options from Compilation
     this.Parse(parser);
     this.SetContainingNodes();
     ErrorEventArgs errorEventArguments = new ErrorEventArgs(ErrorReporter.Instance, this.SourceLocation, cp.ScannerAndParserErrors.AsReadOnly());
     this.Compilation.HostEnvironment.ReportErrors(errorEventArguments);
     errorEventArguments = new ErrorEventArgs(ErrorReporter.Instance, cp.UnpreprocessedDocument.SourceLocation, cp.PreprocessorErrors);
     this.Compilation.HostEnvironment.ReportErrors(errorEventArguments);
     this.isInitialized = true;
   }
 }
 public bool DownloadFile(Uri uri, String fileName)
 {
     this.fileName = fileName;
     statusCode = "Unknown";
     contentLength = 0;
     try {
         WebRequest webRequest = HttpWebRequest.Create(uri);
         webRequest.BeginGetResponse(new AsyncCallback(requestCallBack), webRequest);
         State = ConnectState.Connect;
     } catch (Exception e) {
         Console.WriteLine(e);
         State = ConnectState.Failed;
         ErrorEventArgs args = new ErrorEventArgs();
         args.Message = e.Message;
         OnErrorOccurred(args);
         return false;
     }
     return true;
 }
Exemple #11
0
        void OnSymbolInfo(object sender, SymbolInfoEventArgs e)
        {
            try
            {
                var symbols = e.Information
                               .Select(o => o.Name)
                               .ToArray();

                this.feed.Server.SubscribeToQuotes(symbols, 1);
            }
            catch(Exception ex)
            {
                var eh = this.Error;
                if (eh != null)
                {
                    var errEventArgs = new ErrorEventArgs(ex);
                    eh(this, errEventArgs);
                }
            }
        }
Exemple #12
0
        /// <summary>
        ///     This event is raised in the case of some error
        ///     This includes pacing violations, in which case we re-enqueue the request.
        /// </summary>
        private void _client_Error(object sender, ErrorEventArgs e)
        {
            //if we asked for too much real time data at once, we need to re-queue the failed request
            if ((int)e.ErrorCode == 420) //a real time pacing violation
            {
                if (!e.ErrorMsg.Contains("No market data permissions"))
                {
                    lock (queueLock)
                    {
                        if (!realTimeRequestQueue.Contains(e.TickerId))
                        {
                            //since the request did not succeed, what we do is re-queue it and it gets requested again by the timer
                            realTimeRequestQueue.Enqueue(e.TickerId);
                        }
                    }
                }
            }
            else if ((int)e.ErrorCode == 162) //a historical data pacing violation
            {
                if (e.ErrorMsg.StartsWith("Historical Market Data Service error message:HMDS query returned no data"))

                {
                    //no data returned = we return an empty data set
                    int origId;

                    lock (subReqMapLock)
                    {
                        //if the data is arriving for a sub-request, we must get the id of the original request first
                        //otherwise it's just the same id
                        origId = subRequestIDMap.ContainsKey(e.TickerId)
                            ? subRequestIDMap[e.TickerId]
                            : e.TickerId;
                    }

                    if (origId != e.TickerId)
                    {
                        //this is a subrequest - only complete the
                        if (ControlSubRequest(e.TickerId))
                        {
                            HistoricalDataRequestComplete(origId);
                        }
                    }
                    else
                    {
                        HistoricalDataRequestComplete(origId);
                    }
                }
                else
                {
                    //simply a data pacing violation
                    lock (queueLock)
                    {
                        if (!historicalRequestQueue.Contains(e.TickerId))
                        {
                            //same as above
                            historicalRequestQueue.Enqueue(e.TickerId);
                        }
                    }
                }
            }
            else if ((int)e.ErrorCode == 200) //No security definition has been found for the request.
            {
                //Again multiple errors share the same code...
                if (e.ErrorMsg.Contains("No security definition has been found for the request"))
                {
                    //this will happen for example when asking for data on expired futures
                    //return an empty data list
                    if (historicalDataRequests.ContainsKey(e.TickerId))
                    {
                        HistoricalDataRequestComplete(e.TickerId);
                    }
                }
                else //in this case we're handling a "Invalid destination exchange specified" error
                {
                    //not sure if there's anything else to do, if it's a real time request it just fails...
                    if (historicalDataRequests.ContainsKey(e.TickerId))
                    {
                        HistoricalDataRequestComplete(e.TickerId);
                    }
                }
            }

            RaiseErrorMessage(e);
        }
Exemple #13
0
 private void WatcherOnError(object sender, ErrorEventArgs errorEventArgs)
 {
     Messenger.Default.Send(new ShowMessageDialogMessage("Project folder deleted", $"The project folder for the workspace {Workspace.Name} was deleted.\nPlease set up the folder and select the workspace again."));
     Messenger.Default.Send(new WorkspaceErrorMessage(Workspace));
 }
 private static void OnError(object sender, ErrorEventArgs args)
 {
     // If needed, put your custom error logic here
     Console.WriteLine(args.ErrorContext.Error.Message);
     args.ErrorContext.Handled = true;
 }
 private void ErrorEventHandler(object sender, ErrorEventArgs e)
 {
     OnError(e);
 }
 void _folderWatcher_Error(object sender, ErrorEventArgs e)
 {
     RefreshReferences();
 }
Exemple #17
0
 internal FileLexerErrorEventArgs(ErrorEventArgs e, LineMap lineMap)
     : this(e.Error, lineMap.Map(e.Position), e.Args)
 {
 }
Exemple #18
0
 private void _FileSystemWatcher_Error(object sender, ErrorEventArgs e)
 {
     LOG.Error(e.GetException());
 }
 //Error event handler...Display the error description to the console
 static void gps_Error(object sender, ErrorEventArgs e)
 {
     Console.WriteLine(e.Description);
 }
Exemple #20
0
 private void OnError(object sender, ErrorEventArgs e)
 {
     _io.InvokeError(e.Message);
 }
 private void TableDependency_OnError(object sender, ErrorEventArgs e)
 {
     Console.WriteLine($"SqlTableDependency error: {e.Error.Message}");
 }
 private void Ws_OnError(object sender, ErrorEventArgs e)
 {
     throw new NotImplementedException();
 }
 protected override void OnError(ErrorEventArgs e)
 {
     base.OnError(e);
 }
Exemple #24
0
 void _mjpeg_Error(object sender, ErrorEventArgs e)
 {
     MessageBox.Show(e.Message);
 }
Exemple #25
0
 /// <summary>
 /// Raises the AuthenticateError event.
 /// </summary>
 /// <param name="e">An <see cref="ErrorEventArgs"/> that contains the event data.</param>
 protected void OnAuthenticateError(ErrorEventArgs e)
 {
     if (this.AuthenticateError != null)
     {
         this.AuthenticateError(this, e);
     }
 }
Exemple #26
0
 void OnError(object sender, ErrorEventArgs e)
 {
     mLog.ErrorFormat("WebSocket connection error: {0}", e.Message);
     mLog.DebugFormat(
         "Stack trace:{0}{1}", Environment.NewLine, e.Exception.StackTrace);
 }
Exemple #27
0
 /// <summary>
 /// Raises the SendError event.
 /// </summary>
 /// <param name="e">An <see cref="ErrorEventArgs"/> that contains the event data.</param>
 protected void OnSendError(ErrorEventArgs e)
 {
     if (this.SendError != null)
     {
         this.SendError(this, e);
     }
 }
 protected override void OnError(ErrorEventArgs e)
 {
     Logger.LogDebug($"SIPMessagWebSocketBehavior.OnError: reason {e.Message}.");
 }
Exemple #29
0
 //error event handler
 void lcd_Error(object sender, ErrorEventArgs e)
 {
     MessageBox.Show(e.Description);
 }
Exemple #30
0
        private void OnAsyncDataLoaded(object sender, EventArgs e)
        {
            Async asyncData = AsyncData;

            if (asyncData == sender) {
                IEnumerable enumerableData = null;
                int estimatedTotalCount = -1;

                if (asyncData.IsCanceled == false) {
                    if (asyncData.HasError) {
                        if ((asyncData.IsErrorHandled == false) && (_errorEventHandler != null)) {
                            ErrorEventArgs errorEventArgs = new ErrorEventArgs(asyncData.Error);
                            _errorEventHandler(this, errorEventArgs);

                            if (errorEventArgs.IsHandled) {
                                asyncData.MarkErrorAsHandled();
                            }
                        }
                    }
                    else {
                        Async<IEnumerable> asyncEnumerable = asyncData as Async<IEnumerable>;
                        if (asyncEnumerable != null) {
                            enumerableData = asyncEnumerable.Result;
                        }
                        else if (asyncData is Async<Tuple<IEnumerable, int>>) {
                            Async<Tuple<IEnumerable, int>> asyncEnumerableAndCount = asyncData as Async<Tuple<IEnumerable, int>>;
                            enumerableData = asyncEnumerableAndCount.Result.Item1;
                            estimatedTotalCount = asyncEnumerableAndCount.Result.Item2;
                        }
                        else {
                            if (asyncData.Result != null) {
                                enumerableData = new object[] { asyncData.Result };
                            }
                        }
                    }
                }

                IsLoadingAsyncData = false;
                AsyncData = null;
                OnDataLoaded(enumerableData, estimatedTotalCount);
            }
        }
Exemple #31
0
 private void _ws_OnError(object sender, ErrorEventArgs e)
 {
     throw new WebSocketConnectionException("Error occured on websocket stream", e.Exception);
 }
 protected void OnErrorEvent(object sender, ErrorEventArgs e)
 {
     this.LastErrorMessage = e.Message;
     if (this.Error != null)
     {
         try { this.Error.Invoke(this, e); }
         catch { }
     }
     Trace.WriteLine(string.Format("Error Event: {0}\r\n\t{1}", e.Message, e.Exception));
 }
Exemple #33
0
 private void _webSocket_OnError(object sender, ErrorEventArgs e)
 {
     _logger.Error(e.Exception.ToString());
 }
 public void Monitor_ErrorOccurred(object sender, ErrorEventArgs e)
 {
     try
     {
         this.Invoke(new EventHandler<ErrorEventArgs>(Monitor_ErrorOccurredHandler), sender, e);
     }
     catch(Exception ex)
     {
         MessageBox.Show("Monitor_Error: " + ex.Message,
                         clsUtil.TituloAviso,
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation,                   
                         MessageBoxDefaultButton.Button1);
     }
 }
Exemple #35
0
 private static void WatcherError(object sender, ErrorEventArgs e)
 {
     WriteLine($"ERROR: file system watching may no longer be active: {e.GetException()}");
 }
 /// <summary>
 /// Is called when the inner <see cref="WebSocket"/> or current <see cref="WebSocketService"/>
 /// gets an error.
 /// </summary>
 /// <param name="e">
 /// An <see cref="ErrorEventArgs"/> that contains an event data associated with
 /// an inner <see cref="WebSocket.OnError"/> event.
 /// </param>
 protected virtual void OnError(ErrorEventArgs e)
 {
 }
Exemple #37
0
 /// <summary>
 /// Handles the OnError event of the WebSocket control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="ErrorEventArgs"/> instance containing the event data.</param>
 /// <exception cref="System.NotImplementedException"></exception>
 private void WebSocket_OnError(object sender, ErrorEventArgs e)
 {
     logger.Error("Bot:WebSocket Error. What now?");
     Disconnect();
 }
Exemple #38
0
 internal void OnError(TaskNode node, Exception exc, object item, ref bool stopProcessing)
 {
     if (Error != null)
     {
         ErrorEventArgs args = new ErrorEventArgs() { Error = exc, ProcessedItem=item, StopProcessing = stopProcessing, Node = node };
         Error(this, args);
         stopProcessing = args.StopProcessing;
     }
     else
     {
         stopProcessing = true;
     }
     if (stopProcessing) _stoppingException = exc;
 }
 void OnError(object sender, ErrorEventArgs e)
 {
     Console.WriteLine("Error " + e.Message);
 }
Exemple #40
0
 /// <summary>
 ///     Fired when the FileSystemWatcher errors.
 /// </summary>
 private protected abstract void OnError(object sender, ErrorEventArgs e);
Exemple #41
0
        /// <summary>
        /// Raises the Error event.
        /// </summary>
        /// <param name="message">The error message.</param>
        /// <param name="e">Any exception associated with the error.</param>
        protected void RaiseError(string message, Exception e)
        {
            Exception error = new Exception(message, e);
            bool handled = false;

            if (_errorEventHandler != null) {
                ErrorEventArgs errorEventArgs = new ErrorEventArgs(error);

                _errorEventHandler(this, errorEventArgs);
                handled = errorEventArgs.IsHandled;
            }

            if (handled == false) {
                throw error;
            }
        }
Exemple #42
0
 protected virtual void HandleDeserializationError(object sender, ErrorEventArgs errorArgs)
 {
     errorArgs.ErrorContext.Handled = true;
 }
Exemple #43
0
 void _fontDownloader_DownloadFailed(object sender, ErrorEventArgs e)
 {
     //throw new NotImplementedException();
 }
 private void OnFileError(object sender, ErrorEventArgs e)
 {
     _tailActor.Tell(new TailActor.FileError(_fileNameOnly, e.GetException().Message), ActorRefs.NoSender);
 }
 public void Monitor_ErrorOccurredHandler(object sender, ErrorEventArgs e)
 {
     MessageBox.Show(e.CustomeError.Message);
 }
 private void Fsw_Error(object sender, ErrorEventArgs e)
 {
     _logger.LogInformation($"{e}");
 }
Exemple #47
0
 private void Socket_OnError(object sender, ErrorEventArgs e)
 {
     LogHelper.Info("Koala数据传输异常");
     IsConnected = false;
     reset.Set();
 }
Exemple #48
0
 void ErrorHandler(object sender, ErrorEventArgs e)
 {
     Debug.LogError(e.Message + (e.Exception != null ? e.Exception.Message : ""));
     Connect(name, period);
 }
 private void onError(object sender, ErrorEventArgs e)
 {
     OnError (e);
 }
Exemple #50
0
 void ErrorHandler(object sender, ErrorEventArgs e)
 {
     UnityEngine.Debug.LogError(e.Message + "\n" + (e.Exception != null ? e.Exception.Message : ""));
     throw e.Exception ?? new Exception("Unknown");
 }
Exemple #51
0
 /// <summary>
 /// Raises the AcceptError event.
 /// </summary>
 /// <param name="e">An <see cref="ErrorEventArgs"/> that contains the event data.</param>
 protected void OnAcceptError(ErrorEventArgs e)
 {
     if (this.AcceptError != null)
     {
         this.AcceptError(this, e);
     }
 }
Exemple #52
0
 protected override void OnError(ErrorEventArgs e)
 {
     Console.WriteLine("WebSocket error: " + e.Message);
 }
Exemple #53
0
 /// <summary>
 /// Raises the ReceiveError event.
 /// </summary>
 /// <param name="e">An <see cref="ErrorEventArgs"/> that contains the event data.</param>
 protected void OnReceiveError(ErrorEventArgs e)
 {
     if (this.ReceiveError != null)
     {
         this.ReceiveError(this, e);
     }
 }
Exemple #54
0
 private void TableDependency_OnError(object sender, ErrorEventArgs e)
 {
     Assert.Fail(e.Error.Message);
 }
Exemple #55
0
 protected virtual void OnIOError(ErrorEventArgs e)
 {
     if (Error != null)
         Error(this, e);
 }
Exemple #56
0
 private void onErrorEvent(object sender, ErrorEventArgs e)
 {
     Debug.Log("Error: " + e.Message);
     Debug.Log("Excepcion: " + e.Exception);
 }
 void servo_Error(object sender, ErrorEventArgs e)
 {
     Phidget phid = (Phidget)sender;
     DialogResult result;
     switch (e.Type)
     {
         case PhidgetException.ErrorType.PHIDGET_ERREVENT_BADPASSWORD:
             phid.close();
             TextInputBox dialog = new TextInputBox("Error Event",
                 "Authentication error: This server requires a password.", "Please enter the password, or cancel.");
             result = dialog.ShowDialog();
             if (result == DialogResult.OK)
                 openCmdLine(phid, dialog.password);
             else
                 Environment.Exit(0);
             break;
         default:
             if (!errorBox.Visible)
                 errorBox.Show();
             break;
     }
     errorBox.addMessage(DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + ": " + e.Description);
 }
 private void OnError(object sender, ErrorEventArgs e)
 {
     EmitEvent("error");
 }
 void EditAdControl_AdControlError(object sender, ErrorEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine(String.Format("{0} - {1}", e.ErrorCode, e.ErrorDescription));
 }
Exemple #60
0
 public static void OnError(object sender, ErrorEventArgs args)
 {
     ToStringSettings.lastError = args.ErrorContext.Error;
     args.ErrorContext.Handled  = true;
 }