package org.springblade.common.exception;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springblade.common.enums.ResCode;

/**
 * @author: lianghanqiang
 * @description: 业务异常处理类
 * @since: 7/29/21 -- 2:27 PM
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class BizException extends RuntimeException {

	private static final String DEFAULT_ERR_MSG = "系统异常，请稍后重试！";

	String errMsg = DEFAULT_ERR_MSG;

	Integer status = 500;

	public BizException(ResCode resCode){
		this.errMsg = resCode.getMsg();
		this.status = resCode.getStatus();
	}
}
