BusinessException.java 1018 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.izouma.awesomeAdmin.exception;
  2. import java.util.function.Supplier;
  3. public class BusinessException extends RuntimeException implements Supplier<BusinessException> {
  4. private static final long serialVersionUID = 3779880207424189309L;
  5. private Integer code = -1;
  6. private String error;
  7. public BusinessException(String error) {
  8. super();
  9. this.error = error;
  10. }
  11. public BusinessException(String error, String message) {
  12. super(message);
  13. this.error = error;
  14. }
  15. public BusinessException(String error, String message, Integer code) {
  16. super(message);
  17. this.code = code;
  18. this.error = error;
  19. }
  20. public BusinessException(String error, int code) {
  21. super();
  22. this.error = error;
  23. this.code = code;
  24. }
  25. @Override
  26. public BusinessException get() {
  27. return this;
  28. }
  29. public Integer getCode() {
  30. return code;
  31. }
  32. public String getError() {
  33. return error;
  34. }
  35. }