package com.dsk.common.exception;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.experimental.FieldDefaults;


@Getter
@FieldDefaults(level=AccessLevel.PRIVATE)
public class BusinessException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	Integer code;
	
	String msg;


	public BusinessException(String msg) {
		super(msg);
		this.msg = msg;
	}
	

	public BusinessException(Integer code, String msg) {
		super();
		this.code = code;
		
		this.msg = msg;
	}
	
	public BusinessException(String msg, Object... params) {
		for (Object param : params) {
			msg = msg.replaceFirst("\\{\\}", param.toString());
		}
		this.msg = msg;
	}
	

	public BusinessException(int code, String msg, Object... params) {
		this.code = code;
		for (Object param : params) {
			msg = msg.replaceFirst("\\{\\}", param.toString());
		}
		this.msg = msg;
	}

	
	public BusinessException(Throwable throwable) {
		super(throwable);
	}



	public String getMsg() {
		return msg;
	}







}
