GlobalException.java 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package com.ozs.common.exception;
  2. /**
  3. * 全局异常
  4. *
  5. * @author ruoyi
  6. */
  7. public class GlobalException extends RuntimeException
  8. {
  9. private static final long serialVersionUID = 1L;
  10. /**
  11. * 错误提示
  12. */
  13. private String message;
  14. /**
  15. * 错误明细,内部调试错误
  16. *
  17. * 和 {@link CommonResult#getDetailMessage()} 一致的设计
  18. */
  19. private String detailMessage;
  20. /**
  21. * 空构造方法,避免反序列化问题
  22. */
  23. public GlobalException()
  24. {
  25. }
  26. public GlobalException(String message)
  27. {
  28. this.message = message;
  29. }
  30. public String getDetailMessage()
  31. {
  32. return detailMessage;
  33. }
  34. public GlobalException setDetailMessage(String detailMessage)
  35. {
  36. this.detailMessage = detailMessage;
  37. return this;
  38. }
  39. @Override
  40. public String getMessage()
  41. {
  42. return message;
  43. }
  44. public GlobalException setMessage(String message)
  45. {
  46. this.message = message;
  47. return this;
  48. }
  49. }