TopException.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. using System.Runtime.Serialization;
  3. namespace Top.Api
  4. {
  5. /// <summary>
  6. /// TOP客户端异常。
  7. /// </summary>
  8. public class TopException : Exception
  9. {
  10. private string errorCode;
  11. private string errorMsg;
  12. private string subErrorCode;
  13. private string subErrorMsg;
  14. public TopException()
  15. : base()
  16. {
  17. }
  18. public TopException(string message)
  19. : base(message)
  20. {
  21. }
  22. protected TopException(SerializationInfo info, StreamingContext context)
  23. : base(info, context)
  24. {
  25. }
  26. public TopException(string message, Exception innerException)
  27. : base(message, innerException)
  28. {
  29. }
  30. public TopException(string errorCode, string errorMsg)
  31. : base(errorCode + ":" + errorMsg)
  32. {
  33. this.errorCode = errorCode;
  34. this.errorMsg = errorMsg;
  35. }
  36. public TopException(string errorCode, string errorMsg, string subErrorCode, string subErrorMsg)
  37. : base(errorCode + ":" + errorMsg + ":" + subErrorCode + ":" + subErrorMsg)
  38. {
  39. this.errorCode = errorCode;
  40. this.errorMsg = errorMsg;
  41. this.subErrorCode = subErrorCode;
  42. this.subErrorMsg = subErrorMsg;
  43. }
  44. public string ErrorCode
  45. {
  46. get { return this.errorCode; }
  47. }
  48. public string ErrorMsg
  49. {
  50. get { return this.errorMsg; }
  51. }
  52. public string SubErrorCode
  53. {
  54. get { return this.subErrorCode; }
  55. }
  56. public string SubErrorMsg
  57. {
  58. get { return this.subErrorMsg; }
  59. }
  60. }
  61. }