/// <summary> /// Constructor accepting enumeration and message. /// </summary> /// <param name="exceptionEventCode">event enumeration that was defined in resource table</param> /// <param name="message">Specific message containing details of event</param> public ExceptionEvent(enumExceptionEventCodes exceptionEventCode, string message) : base(string.Format("{0}{1}{2}", exceptionEventCode.ToString() , message , Environment.NewLine)) { _exceptionEventCode = exceptionEventCode; _exceptionCode = Convert.ToInt32(exceptionEventCode); _msg = message; _description = LookupDescription(exceptionEventCode); base.HResult = _exceptionCode; }
string LookupDescription(enumExceptionEventCodes exceptionEventCode) { try { return(EventCodes.ResourceManager.GetString(exceptionEventCode.ToString())); } catch (Exception e) { return(exceptionEventCode.ToString() + " was NOT found in the exception resource table." + e.Message); } }
/// <summary> /// Constructor accepting enumeration and message and an inner exception /// </summary> /// <param name="exceptionEventCode">event enumeration that was defined in resource table</param> /// <param name="description">Description of event or description</param> /// <param name="innerException">The exception object associated with the event.</param> public ExceptionEvent(enumExceptionEventCodes exceptionEventCode , string description , Exception innerException) : base(string.Format("{0}{1}{2}", exceptionEventCode.ToString() , description , Environment.NewLine) , innerException) { _exceptionEventCode = exceptionEventCode; _exceptionCode = Convert.ToInt32(exceptionEventCode); _msg = Message; _description = description; base.HResult = _exceptionCode; }