Files
timeline-server/timeline-component-common/src/main/java/com/timeline/exception/CustomException.java
jiangh277 f8fb9b561c init
2025-07-22 23:00:39 +08:00

33 lines
809 B
Java

package com.timeline.exception;
import com.timeline.response.ResponseEnum;
public class CustomException extends RuntimeException {
private final int code;
private final String message;
public CustomException(ResponseEnum responseEnum) {
this.code = responseEnum.getCode();
this.message = responseEnum.getMessage();
}
public CustomException(ResponseEnum responseEnum, String detailMessage) {
this.code = responseEnum.getCode();
this.message = responseEnum.getMessage() + ": " + detailMessage;
}
public CustomException(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
@Override
public String getMessage() {
return message;
}
}