LogException.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #region --------------- Copyright Dresser Wayne Pignone -------------
  2. /*
  3. * $Log: /Wrk/WayneLibraries/Wrk/Log/LogException.cs $
  4. *
  5. * 2 08-02-13 9:28 Mattias.larsson
  6. * FxCop fixes.
  7. */
  8. #endregion
  9. using System;
  10. namespace Wayne.Lib.Log
  11. {
  12. /// <summary>
  13. /// General log exception.
  14. /// </summary>
  15. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable")]
  16. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")]
  17. public class LogException : Exception
  18. {
  19. #region Fields
  20. private LogExceptionType type;
  21. #endregion
  22. #region Construction
  23. /// <summary>
  24. /// Construction.
  25. /// </summary>
  26. public LogException(LogExceptionType type)
  27. {
  28. this.type = type;
  29. }
  30. /// <summary>
  31. /// Construction.
  32. /// </summary>
  33. public LogException(LogExceptionType type, string message)
  34. : base(message)
  35. {
  36. this.type = type;
  37. }
  38. /// <summary>
  39. /// Construction.
  40. /// </summary>
  41. public LogException(LogExceptionType type, string message, Exception inner)
  42. : base(message, inner)
  43. {
  44. this.type = type;
  45. }
  46. #endregion
  47. #region Properties
  48. /// <summary>
  49. /// The type of exception.
  50. /// </summary>
  51. public LogExceptionType LogExceptionType
  52. {
  53. get { return type; }
  54. }
  55. #endregion
  56. #region Methods
  57. /// <summary>
  58. /// The Message
  59. /// </summary>
  60. public override string Message
  61. {
  62. get
  63. {
  64. return string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}: \"{1}\"", type, base.Message);
  65. }
  66. }
  67. /// <summary>
  68. /// ToString.
  69. /// </summary>
  70. /// <returns></returns>
  71. public override string ToString()
  72. {
  73. return string.Format(System.Globalization.CultureInfo.InvariantCulture, "LogException({0}){1}", type, base.ToString());
  74. }
  75. #endregion
  76. }
  77. }