Beispiel #1
0
        public void PromptExceptionErrorMessage(Active ap, string ProcessName, Exception ex)
        {
            ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);

            ErrorMessageHST errorMessageHST = new ErrorMessageHST(ap, btnlst, ex);

            errorMessageHST.Format(ex);
            errorMessageHST.SourceProcess = ProcessName;
            errorMessageHST.SourceState   = ap.CurrentStateName;
            errorMessageHST.Format();
            Log.Error(this, "{0}, ProcessName:{1}, Error:{2}", LoggerCategory.StateTransition, ProcessName, ex.ToString());

            ServiceManager.ErrorHandler.RegisterMessage(errorMessageHST);
        }
Beispiel #2
0
        protected override void TransitionToErrorState(ButtonList buttonList, Exception exception)
        {
            this.currentException = exception;

            {
                this.errorMessageHST = new ErrorMessageHST(this, buttonList, exception);
                this.errorMessageHST.Format(this.currentException);
                this.errorMessageHST.SourceProcess = this._processName;
                this.errorMessageHST.SourceState   = this.CurrentStateName;

                if (this.errorMessageHST.Exception is HSTException)
                {
                    if (String.IsNullOrEmpty(((HSTException)this.errorMessageHST.Exception).ErrorCode) == false)
                    {
                        int  value;
                        bool result = int.TryParse(((HSTException)this.errorMessageHST.Exception).ErrorCode, out value);
                        if (result == false)
                        {
                            // String is not a number.
                        }
                        else
                        {
                            int errorType = value - (value % 1000000);
                            if (errorType == (int)AutomationSystem.ImmediateStop)
                            {
                                HSTWorkcell.stopSystemDueToAxisError = true;
                                Log.Error(this, "stopSystemDueToAxisError: True. Automation system has to be stopped immediately due to critical error code: {0} generated by {1}.", this.errorMessageHST.Source, this.errorMessageHST.SourceProcess);
                            }
                        }
                    }
                }

                this.errorMessage = new APErrorMessage(this, buttonList);
                this.errorMessage = this.errorMessageHST;
                this.errorMessage.Format(this.currentException);
                this.errorMessage.Priority = 999;
            }
            this.stateHistory = this.targetState;
            base.PostFIFO(new QEvent(this.SigError));
        }