You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
645 B
29 lines
645 B
3 years ago
|
package com.qs.serve.common.util;
|
||
|
|
||
|
|
||
|
import com.qs.serve.common.framework.exception.BusinessException;
|
||
|
import com.qs.serve.common.model.enums.HttpCode;
|
||
|
import lombok.experimental.UtilityClass;
|
||
|
|
||
|
/**
|
||
|
* 抛出异常工具类
|
||
|
* @author YenHex
|
||
|
* @since 2022/2/25
|
||
|
*/
|
||
|
@UtilityClass
|
||
|
public class Assert {
|
||
|
|
||
|
public static void throwEx(Integer code,String msg){
|
||
|
throw new BusinessException(msg, code);
|
||
|
}
|
||
|
|
||
|
public static void throwEx(HttpCode httpCode){
|
||
|
throw new BusinessException(httpCode.getMsg(),httpCode.getCode());
|
||
|
}
|
||
|
|
||
|
public static void throwEx(String msg){
|
||
|
throw new BusinessException(msg,500);
|
||
|
}
|
||
|
|
||
|
}
|