public void Erreur_Robot_OvervoltageError_Bien_Traite() { RobotException ex = new RobotException(1, FrameHeaders.Hardware, ErrorEmcyCodes.OvervoltageError, "RobotException"); GestionErreur.GerrerErreur(ex); msbs.Verify(mm => mm.ShowError(ex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration)); log.Verify(ll => ll.Error(ex.GetType().Name + " | NodeId: " + ex.NodeId + " | Adresse: " + ex.Adresse + " | ErrorCode :" + ex.ErrorCode + " | " + ex.Message + " |" + ex.StackTrace)); }
public void Erreur_Robot_SupplyVoltageOutputStageTooLow_Bien_Traite() { RobotException ex = new RobotException(1, FrameHeaders.Hardware, ErrorEmcyCodes.SupplyVoltageOutputStageTooLow, "RobotException"); GestionErreur.GerrerErreur(ex); msbs.Verify(mm => mm.ShowError(ex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone)); log.Verify(ll => ll.Error(ex.GetType().Name + " | NodeId: " + ex.NodeId + " | Adresse: " + ex.Adresse + " | ErrorCode :" + ex.ErrorCode + " | " + ex.Message + " |" + ex.StackTrace)); }
private static string MessageCalibOuCall(RobotException rex) { bool find = false; string month, day; DateTime dateJour = DateTime.Now; if (dateJour.Month.ToString().Length == 1) { month = "0" + dateJour.Month.ToString(); } else { month = dateJour.Month.ToString(); } if (dateJour.Day.ToString().Length == 1) { day = "0" + dateJour.Day.ToString(); } else { day = dateJour.Day.ToString(); } var line = File.ReadLines("../../../AxView/bin/Debug/log/Error.txt").SkipWhile(l => !l.Contains(dateJour.Year.ToString() + "-" + month + "-" + day)); for (int i = 0; i < line.Count(); i++) { if (line.ElementAt(i).Contains(rex.ErrorCode.ToString())) { find = true; } } if (find == false) { return(rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration); } else { return(rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone); } }
private static void MessageErreurRobot(RobotException rex) { switch (rex.ErrorCode) { case ErrorEmcyCodes.OvercurrentError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_ArretRobot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.OvervoltageError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.UndervoltageError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.OvertemperatureError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_ArretRobot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.LogicSupplyVoltageTooLowError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.SupplyVoltageOutputStageTooLow: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.InternalSoftwareError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.SoftwareParameterError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.PositionSensorError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.CanOverrunErrorObjectsLost: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.CanOverrunError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.CanPassiveModeError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.CanLifeGuardError: errorMessage = MessageCalibOuCall(rex); break; case ErrorEmcyCodes.CanTransmitCobIdCollisionError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.CanBusOffError: errorMessage = MessageCalibOuCall(rex); break; case ErrorEmcyCodes.CanRxQueueOverflowError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.CanTxQueueOverflowError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.CanPdoLengthError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.FollowingError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.HallSensorError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.IndexProcessingError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.EncoderResolutionError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.HallSensorNotFoundError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.NegativeLimitSwitchError: errorMessage = MessageCalibOuCall(rex); break; case ErrorEmcyCodes.PositiveLimitSwitchError: errorMessage = MessageCalibOuCall(rex); break; case ErrorEmcyCodes.HallAngleDetectionError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.SoftwarePositionLimitError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Calibration; break; case ErrorEmcyCodes.PositionSensorBreachError: errorMessage = MessageCalibOuCall(rex); break; case ErrorEmcyCodes.SystemOverloadedError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.InterpolatedPositionModeError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.AutoTuningIdentificationError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.GearScalingFactorError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.ControllerGainError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.MainSensorDirectionError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; case ErrorEmcyCodes.AuxiliarySensorDirectionError: errorMessage = rex.Message + "\n" + AxLanguage.Languages.REAplan_Erreur_Robot + "\n" + AxLanguage.Languages.REAplan_Erreur_Call + "\n" + AxLanguage.Languages.REAplan_Erreur_NumeroTelephone; break; default: errorMessage = ""; break; } }
private static void LoggerRobotError(RobotException rex) { logger.Error(rex.GetType().Name + " | NodeId: " + rex.NodeId + " | Adresse: " + rex.Adresse + " | ErrorCode :" + rex.ErrorCode + " | " + rex.Message + " |" + rex.StackTrace); }