DescribeException.java 887 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package com.ydtech.aop.exception;
  2. /**
  3. * 错误描述
  4. * Created by zhengping.zhu
  5. * on 2017/5/7.
  6. */
  7. public class DescribeException extends RuntimeException {
  8. private Integer code;
  9. /**
  10. * 继承exception,加入错误状态值
  11. *
  12. * @param exceptionEnum
  13. */
  14. public DescribeException(ExceptionEnum exceptionEnum) {
  15. super(exceptionEnum.getMsg());
  16. this.code = exceptionEnum.getCode();
  17. }
  18. public DescribeException(String message) {
  19. super(message);
  20. this.code = 500;
  21. }
  22. /**
  23. * 自定义错误信息
  24. *
  25. * @param message
  26. * @param code
  27. */
  28. public DescribeException(String message, Integer code) {
  29. super(message);
  30. this.code = code;
  31. }
  32. public Integer getCode() {
  33. return code;
  34. }
  35. public void setCode(Integer code) {
  36. this.code = code;
  37. }
  38. }