🔄Update: 添加自定义异常

This commit is contained in:
2025-10-18 14:22:07 +08:00
parent 1383f48096
commit 4a451278af
3 changed files with 71 additions and 0 deletions
@@ -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));
}
}