You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.6 KiB

  1. using Apewer.Web;
  2. using System;
  3. namespace Apewer
  4. {
  5. /// <summary>表示目标资源不存在的错误。</summary>
  6. public class NotFoundException : Exception, IApiException
  7. {
  8. static string _default = FixMessage(null);
  9. static string FixMessage(string message)
  10. {
  11. const string Preset = "Resource not found.";
  12. if (message != null)
  13. {
  14. message = message.Trim();
  15. if (!string.IsNullOrEmpty(message)) return message;
  16. }
  17. return Preset;
  18. }
  19. /// <summary>获取或设置默认消息。</summary>
  20. public static string DefaultMessage { get => _default; set => _default = FixMessage(value); }
  21. /// <summary>状态。</summary>
  22. /// <value>Unauthorized</value>
  23. public virtual string Status { get => "Not Found"; }
  24. /// <summary>表示目标资源不存在的错误。</summary>
  25. /// <remarks>默认消息:Operation is not authorized.</remarks>
  26. public NotFoundException() : base(DefaultMessage) { }
  27. /// <summary>表示目标资源不存在的错误。</summary>
  28. /// <remarks>默认消息:Operation is not authorized.</remarks>
  29. public NotFoundException(string message) : base(FixMessage(message)) { }
  30. /// <summary>表示目标资源不存在的错误。</summary>
  31. /// <remarks>默认消息:Operation is not authorized.</remarks>
  32. public NotFoundException(string message, Exception innerException) : base(FixMessage(message), innerException) { }
  33. }
  34. }