BizException.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. namespace TEAMModelOS.SDK.Context.Exception
  3. {
  4. public class BizException : System.Exception
  5. {
  6. public string message { get; set; } = "error";
  7. public int code { get; set; } = 1;
  8. public string devMessage { get; set; }
  9. public BizException(String message, int code, string stackTrace) : base(message)
  10. {
  11. if (string.IsNullOrEmpty(stackTrace))
  12. {
  13. this.devMessage = this.StackTrace;
  14. }
  15. else
  16. {
  17. this.devMessage = stackTrace;
  18. }
  19. this.message = message;
  20. this.code = code;
  21. }
  22. public BizException( String message, int code) : base(message)
  23. {
  24. this.devMessage = this.StackTrace;
  25. this.message = message;
  26. this.code = code;
  27. }
  28. //
  29. // 摘要:
  30. // Initializes a new instance of the System.Exception class.
  31. public BizException() : base()
  32. {
  33. this.devMessage = this.StackTrace;
  34. this.message = "error";
  35. this.code = 1;
  36. }
  37. //
  38. // 摘要:
  39. // Initializes a new instance of the System.Exception class with a specified error
  40. // message.
  41. //
  42. // 参数:
  43. // message:
  44. // The message that describes the error.
  45. public BizException(string message) : base(message)
  46. {
  47. this.message = message;
  48. this.devMessage = this.StackTrace;
  49. this.code = 1;
  50. }
  51. }
  52. }