ServiceException.cs 806 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Bowin.Common.ServiceToken.ApiIdentity
  5. {
  6. /// <summary>
  7. /// Code定义:
  8. /// 0 - 访问成功;
  9. /// -99 - 通用异常,具体参考异常消息提示;
  10. /// -1 - 访问令牌错误;
  11. /// -2 - 未授权操作;
  12. /// </summary>
  13. public class ServiceException : Exception
  14. {
  15. public int Code { get; set; } = -1;
  16. public ServiceException() : base()
  17. {
  18. }
  19. public ServiceException(int code) : base()
  20. {
  21. Code = code;
  22. }
  23. public ServiceException(string message) : base(message)
  24. {
  25. }
  26. public ServiceException(int code, string message) : base(message)
  27. {
  28. Code = code;
  29. }
  30. }
  31. }