BusinessException.java 989 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.izouma.nineth.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(error);
  9. }
  10. public BusinessException(String error, String message) {
  11. super(message);
  12. this.error = error;
  13. }
  14. public BusinessException(String error, String message, Integer code) {
  15. super(message);
  16. this.code = code;
  17. this.error = error;
  18. }
  19. public BusinessException(String error, int code) {
  20. super();
  21. this.error = error;
  22. this.code = code;
  23. }
  24. @Override
  25. public BusinessException get() {
  26. return this;
  27. }
  28. public Integer getCode() {
  29. return code;
  30. }
  31. public String getError() {
  32. return error;
  33. }
  34. }