AbpAuthorizationException.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Runtime.Serialization;
  3. using Abp.Logging;
  4. namespace Abp.Authorization
  5. {
  6. /// <summary>
  7. /// This exception is thrown on an unauthorized request.
  8. /// </summary>
  9. [Serializable]
  10. public class AbpAuthorizationException : AbpException, IHasLogSeverity
  11. {
  12. /// <summary>
  13. /// Severity of the exception.
  14. /// Default: Warn.
  15. /// </summary>
  16. public LogSeverity Severity { get; set; }
  17. /// <summary>
  18. /// Creates a new <see cref="AbpAuthorizationException"/> object.
  19. /// </summary>
  20. public AbpAuthorizationException()
  21. {
  22. Severity = LogSeverity.Warn;
  23. }
  24. /// <summary>
  25. /// Creates a new <see cref="AbpAuthorizationException"/> object.
  26. /// </summary>
  27. public AbpAuthorizationException(SerializationInfo serializationInfo, StreamingContext context)
  28. : base(serializationInfo, context)
  29. {
  30. }
  31. /// <summary>
  32. /// Creates a new <see cref="AbpAuthorizationException"/> object.
  33. /// </summary>
  34. /// <param name="message">Exception message</param>
  35. public AbpAuthorizationException(string message)
  36. : base(message)
  37. {
  38. Severity = LogSeverity.Warn;
  39. }
  40. /// <summary>
  41. /// Creates a new <see cref="AbpAuthorizationException"/> object.
  42. /// </summary>
  43. /// <param name="message">Exception message</param>
  44. /// <param name="innerException">Inner exception</param>
  45. public AbpAuthorizationException(string message, Exception innerException)
  46. : base(message, innerException)
  47. {
  48. Severity = LogSeverity.Warn;
  49. }
  50. }
  51. }