package cn.forevermc.launcher.core;

import cn.forevermc.launcher.bean.Page;
import com.imyeyu.java.bean.Callback;
import com.imyeyu.java.bean.timi.TimiCode;
import com.imyeyu.java.bean.timi.TimiException;

/**
 * 启动异常
 *
 * @author 夜雨
 * @since 2022-12-06 20:01
 */
public class LauncherException extends TimiException {

	/** 异常跳转页面 */
	Page toPage;

	/** 跳转页面事件 */
	Callback toPageEvent;

	/**
	 * 简单构造器
	 *
	 * @param toPage  异常跳转页面
	 * @param message 提示消息
	 */
	public LauncherException(Page toPage, String message) {
		this(null, toPage, message);
	}

	/**
	 * 默认构造器
	 *
	 * @param toPageEvent 跳转前回调
	 * @param toPage      异常跳转页面
	 * @param message     提示消息
	 */
	public LauncherException(Callback toPageEvent, Page toPage, String message) {
		super(TimiCode.ERROR, message);
		this.toPage = toPage;
		this.toPageEvent  = toPageEvent;
	}
}
