Ejemplo n.º 1
0
        /// <summary>
        /// calls method To create responseservices depending on type of exception and level of severity, and then executes them
        /// </summary>
        /// <param name="e"></param>
        /// <param name="level"></param>
        public AnalyzedError GetResponse(AnalyzedError Err)
        {
            IErrorResponseService ResponseService;

            if (Err.Lev == LogLevels.Levels.Fatal)
            {
                ResponseService = new FatalResponseService(Err);
            }
            else if (Err.Lev == LogLevels.Levels.Error)
            {
                ResponseService = new ErrorResponseService(Err);
            }
            else
            {
                ResponseService = new WarningResponseService(Err);
            }
            try
            {
                Logger.Log(Err.ToString());
            }
            catch (Exception caught)
            {
                var Failure = new FatalResponseService(new AnalyzedError(caught)
                {
                    Lev = LogLevels.Levels.Fatal
                });
                Failure.GetResponse();
            }

            return(ResponseService.GetResponse());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Exception contained within the object by assigning managers to the different steps of the tasks
        /// </summary>
        public void Handle()
        {
            var ThreatManager = new ErrorThreatManager(_exceptione);
            var Error         = ThreatManager.GetThreatLevel();
            ErrorResponseManager ResponseManager = new ErrorResponseManager();

            Err = ResponseManager.GetResponse(Error);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Calls the Overloaded GetThreatLevel Method of ErrorThreatService
        /// </summary>
        /// <param name="exceptione"></param>
        /// <returns>Level</returns>
        public AnalyzedError GetThreatLevel()
        {
            AnalyzedError Analysis      = new AnalyzedError(_e);
            var           ThreatService = new ErrorThreatService();

            Analysis.Lev = ThreatService.GetThreatLevel(_e);
            return(Analysis);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Uses base constructor in order to fill the actual parameter fields
 /// base class helps to ensure all email fields have been filled out
 /// </summary>
 /// <param name="e"></param>
 public FatalResponseService(AnalyzedError err) : base($"System Admin:\n An exception of type {err.E.GetType()} " +
                                                       $"has occurred and requires your immediate attention. " +
                                                       $"Please check logs for the day.",
                                                       "The System requires your Immediate Attention",
                                                       "SysAdmin",
                                                       "*****@*****.**")
 {
     Err = err;
 }
Ejemplo n.º 5
0
 public ErrorResponseService(AnalyzedError err)
 {
     Err = err;
 }
 public WarningResponseService(AnalyzedError err)
 {
     Err = err;
 }