[Add] Framework-API 补充三个异常类;

[Add] BuildBotCodeException, InvalidBotCodeException, UnsupportedBotCodeException 添加三种与功能码相关的异常类;
This commit is contained in:
LamGC 2020-10-07 08:47:33 +08:00
parent 8dfaa97040
commit 48d51b9da5
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D
3 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2020 LamGC
*
* ContentGrabbingJi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* ContentGrabbingJi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.lamgc.cgj.bot.framework.message.exception;
import net.lamgc.cgj.bot.framework.message.BotCode;
/**
* 构造 BotCode 异常.
* 当出现某些原因导致无法继续构造 BotCode 时可抛出.
* 需要说明原因.
* @author LamGC
* @see BotCode#fromBotCodeString(String)
* @see BotCode#toBotCodeString()
*/
public class BuildBotCodeException extends Exception {
public BuildBotCodeException(String message) {
super(message);
}
public BuildBotCodeException(String message, Throwable cause) {
super(message, cause);
}
public BuildBotCodeException(Throwable cause) {
super(cause);
}
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2020 LamGC
*
* ContentGrabbingJi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* ContentGrabbingJi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.lamgc.cgj.bot.framework.message.exception;
/**
* 无效 BotCode 异常.
* @author LamGC
* @see net.lamgc.cgj.bot.framework.message.BotCode
* @see net.lamgc.cgj.bot.framework.message.AbstractBotCode
*/
public class InvalidBotCodeException extends Exception {
public InvalidBotCodeException(String message) {
super(message);
}
public InvalidBotCodeException(String message, Throwable cause) {
super(message, cause);
}
public InvalidBotCodeException(Throwable cause) {
super(cause);
}
}

View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2020 LamGC
*
* ContentGrabbingJi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* ContentGrabbingJi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.lamgc.cgj.bot.framework.message.exception;
/**
* 不支持的 BotCode 异常.
* BotCode FunctionName 不受支持时可抛出.
* @author LamGC
* @see net.lamgc.cgj.bot.framework.message.BotCode
* @see net.lamgc.cgj.bot.framework.message.AbstractBotCode
*/
public class UnsupportedBotCodeException extends RuntimeException {
/**
* 构造异常
* @param functionName 功能名
*/
public UnsupportedBotCodeException(String functionName) {
super(functionName);
}
}