Exception.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System;
  2. namespace DateBaseConnectionPool
  3. {
  4. /// <summary>
  5. /// 服务未启动
  6. /// </summary>
  7. public class PoolNotRunException : Exception
  8. {
  9. public PoolNotRunException() : base("服务未启动") { }
  10. public PoolNotRunException(string message) : base(message) { }
  11. }
  12. /// <summary>
  13. /// 服务已经运行或者未完全结束
  14. /// </summary>
  15. public class PoolNotStopException : Exception
  16. {
  17. public PoolNotStopException() : base("服务已经运行或者未完全结束") { }
  18. public PoolNotStopException(string message) : base(message) { }
  19. }
  20. /// <summary>
  21. /// 连接池资源未全部回收
  22. /// </summary>
  23. public class ResCallBackException : Exception
  24. {
  25. public ResCallBackException() : base("连接池资源未全部回收") { }
  26. public ResCallBackException(string message) : base(message) { }
  27. }
  28. /// <summary>
  29. /// 连接池已经饱和,不能提供连接
  30. /// </summary>
  31. public class PoolFullException : Exception
  32. {
  33. public PoolFullException() : base("连接池已经饱和,不能提供连接") { }
  34. public PoolFullException(string message) : base(message) { }
  35. }
  36. /// <summary>
  37. /// 服务状态错误
  38. /// </summary>
  39. public class StateException : Exception
  40. {
  41. public StateException() : base("服务状态错误") { }
  42. public StateException(string message) : base(message) { }
  43. }
  44. /// <summary>
  45. /// 一个key对象只能申请一个连接
  46. /// </summary>
  47. public class KeyExecption : Exception
  48. {
  49. public KeyExecption() : base("一个key对象只能申请一个连接") { }
  50. public KeyExecption(string message) : base(message) { }
  51. }
  52. /// <summary>
  53. /// 无法释放,不存在的key
  54. /// </summary>
  55. public class NotKeyExecption : Exception
  56. {
  57. public NotKeyExecption() : base("无法释放,不存在的key") { }
  58. public NotKeyExecption(string message) : base(message) { }
  59. }
  60. /// <summary>
  61. /// 当前连接池状态不可以对属性赋值
  62. /// </summary>
  63. public class SetValueExecption : Exception
  64. {
  65. public SetValueExecption() : base("当前连接池状态不可以对属性赋值") { }
  66. public SetValueExecption(string message) : base(message) { }
  67. }
  68. /// <summary>
  69. /// 参数范围错误
  70. /// </summary>
  71. public class ParameterBoundExecption : Exception
  72. {
  73. public ParameterBoundExecption() : base("参数范围错误") { }
  74. public ParameterBoundExecption(string message) : base(message) { }
  75. }
  76. /// <summary>
  77. /// 无效的ConnTypeEnum类型参数
  78. /// </summary>
  79. public class ConnTypeExecption : Exception
  80. {
  81. public ConnTypeExecption() : base("无效的ConnTypeEnum类型参数") { }
  82. public ConnTypeExecption(string message) : base(message) { }
  83. }
  84. /// <summary>
  85. /// 连接资源耗尽,或错误的访问时机。
  86. /// </summary>
  87. public class OccasionExecption : Exception
  88. {
  89. public OccasionExecption() : base("连接资源耗尽,或错误的访问时机。") { }
  90. public OccasionExecption(string message) : base(message) { }
  91. }
  92. /// <summary>
  93. /// 连接资源已经失效。
  94. /// </summary>
  95. public class ResLostnExecption : Exception
  96. {
  97. public ResLostnExecption() : base("连接资源已经失效。") { }
  98. public ResLostnExecption(string message) : base(message) { }
  99. }
  100. /// <summary>
  101. /// 连接资源不可以被分配。
  102. /// </summary>
  103. public class AllotExecption : Exception
  104. {
  105. public AllotExecption() : base("连接资源不可以被分配。") { }
  106. public AllotExecption(string message) : base(message) { }
  107. }
  108. /// <summary>
  109. /// 连接资源已经被分配并且不允许重复引用。
  110. /// </summary>
  111. public class AllotAndRepeatExecption : AllotExecption
  112. {
  113. public AllotAndRepeatExecption() : base("连接资源已经被分配并且不允许重复引用") { }
  114. public AllotAndRepeatExecption(string message) : base(message) { }
  115. }
  116. /// <summary>
  117. /// 引用记数已经为0。
  118. /// </summary>
  119. public class RepeatIsZeroExecption : Exception
  120. {
  121. public RepeatIsZeroExecption() : base("引用记数已经为0。") { }
  122. public RepeatIsZeroExecption(string message) : base(message) { }
  123. }
  124. }