🔄Update: 添加自定义异常
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package cn.hezhaohui.thumb.exception;
|
||||
|
||||
public class ThrowUtils {
|
||||
|
||||
public static void throwIf(boolean condition, RuntimeException runtimeException) {
|
||||
if (condition) {
|
||||
throw runtimeException;
|
||||
}
|
||||
}
|
||||
|
||||
public static void throwIf(boolean condition, ErrorCode errorCode) {
|
||||
throwIf(condition, new BusinessException(errorCode));
|
||||
}
|
||||
|
||||
public static void throwIf(boolean condition, ErrorCode errorCode, String message) {
|
||||
throwIf(condition, new BusinessException(errorCode, message));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user