HistoryFunctionNonFatalException.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. namespace PaintDotNet.Measurement
  3. {
  4. /// <summary>
  5. /// This class is treated differently than an Exception in that the Message property
  6. /// is used as a localized error string that will be displayed to the user. Also,
  7. /// exceptions of this type are treated as non-fatal, and it is assumed that any
  8. /// function being executed has not caused any changes.
  9. /// If null is given for localizedErrorText, a generic message may be provided to
  10. /// the user instead.
  11. /// </summary>
  12. public class HistoryFunctionNonFatalException : Exception
  13. {
  14. private string localizedErrorText;
  15. public string LocalizedErrorText
  16. {
  17. get
  18. {
  19. return this.localizedErrorText;
  20. }
  21. }
  22. private const string message = "Non-fatal exception encountered";
  23. public HistoryFunctionNonFatalException()
  24. {
  25. this.localizedErrorText = null;
  26. }
  27. public HistoryFunctionNonFatalException(string localizedErrorText)
  28. : base(message)
  29. {
  30. this.localizedErrorText = localizedErrorText;
  31. }
  32. public HistoryFunctionNonFatalException(string localizedErrorText, Exception innerException)
  33. : base(message, innerException)
  34. {
  35. this.localizedErrorText = localizedErrorText;
  36. }
  37. }
  38. }