Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
ponfee committed May 5, 2024
1 parent 8cfbc2d commit f143a37
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ public abstract class BaseException extends Exception {
*/
private final int code;

public BaseException(int code) {
protected BaseException(int code) {
this(code, null, null);
}

public BaseException(CodeMsg codeMsg) {
protected BaseException(CodeMsg codeMsg) {
this(codeMsg.getCode(), codeMsg.getMsg(), null);
}

/**
* @param code error code
* @param message error message
*/
public BaseException(int code, String message) {
protected BaseException(int code, String message) {
this(code, message, null);
}

public BaseException(CodeMsg codeMsg, Throwable cause) {
protected BaseException(CodeMsg codeMsg, Throwable cause) {
this(codeMsg.getCode(), codeMsg.getMsg(), cause);
}

Expand All @@ -56,7 +56,7 @@ public BaseException(CodeMsg codeMsg, Throwable cause) {
* @param message error message
* @param cause root cause
*/
public BaseException(int code, String message, Throwable cause) {
protected BaseException(int code, String message, Throwable cause) {
super(message, cause);
this.code = code;
}
Expand All @@ -68,11 +68,11 @@ public BaseException(int code, String message, Throwable cause) {
* @param enableSuppression the enableSuppression
* @param writableStackTrace then writableStackTrace
*/
public BaseException(int code,
String message,
Throwable cause,
boolean enableSuppression,
boolean writableStackTrace) {
protected BaseException(int code,
String message,
Throwable cause,
boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
this.code = code;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ public abstract class BaseRuntimeException extends RuntimeException {
*/
private final int code;

public BaseRuntimeException(int code) {
protected BaseRuntimeException(int code) {
this(code, null, null);
}

public BaseRuntimeException(CodeMsg codeMsg) {
protected BaseRuntimeException(CodeMsg codeMsg) {
this(codeMsg.getCode(), codeMsg.getMsg(), null);
}

/**
* @param code error code
* @param message error message
*/
public BaseRuntimeException(int code, String message) {
protected BaseRuntimeException(int code, String message) {
this(code, message, null);
}

public BaseRuntimeException(CodeMsg codeMsg, Throwable cause) {
protected BaseRuntimeException(CodeMsg codeMsg, Throwable cause) {
this(codeMsg.getCode(), codeMsg.getMsg(), cause);
}

Expand All @@ -56,7 +56,7 @@ public BaseRuntimeException(CodeMsg codeMsg, Throwable cause) {
* @param message error message
* @param cause root cause
*/
public BaseRuntimeException(int code, String message, Throwable cause) {
protected BaseRuntimeException(int code, String message, Throwable cause) {
super(message, cause);
this.code = code;
}
Expand All @@ -68,11 +68,11 @@ public BaseRuntimeException(int code, String message, Throwable cause) {
* @param enableSuppression the enableSuppression
* @param writableStackTrace then writableStackTrace
*/
public BaseRuntimeException(int code,
String message,
Throwable cause,
boolean enableSuppression,
boolean writableStackTrace) {
protected BaseRuntimeException(int code,
String message,
Throwable cause,
boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
this.code = code;
}
Expand Down

0 comments on commit f143a37

Please sign in to comment.