HelperException.java 632 B

12345678910111213141516171819202122232425262728293031
  1. package nju.seec.helper.util.exception;
  2. import lombok.AllArgsConstructor;
  3. import lombok.Getter;
  4. /**
  5. * @author cst
  6. */
  7. @Getter
  8. @AllArgsConstructor(staticName = "of")
  9. public class HelperException extends RuntimeException {
  10. private final ExceptionType type;
  11. private final String msg;
  12. @Getter
  13. public enum ExceptionType {
  14. // http code
  15. NOT_LOGIN(401), FORBIDDEN(403), NOT_FOUND(404), CONFLICT(409), SYSTEM_ERROR(500);
  16. private int code;
  17. ExceptionType(int code) {
  18. this.code = code;
  19. }
  20. }
  21. @Override
  22. public String getMessage() {
  23. return msg;
  24. }
  25. }