From 48d51b9da5bcb67a826b7c2c0ec275e0fef84311 Mon Sep 17 00:00:00 2001 From: LamGC Date: Wed, 7 Oct 2020 08:47:33 +0800 Subject: [PATCH] =?UTF-8?q?[Add]=20Framework-API=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E4=B8=89=E4=B8=AA=E5=BC=82=E5=B8=B8=E7=B1=BB;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Add] BuildBotCodeException, InvalidBotCodeException, UnsupportedBotCodeException 添加三种与功能码相关的异常类; --- .../exception/BuildBotCodeException.java | 43 +++++++++++++++++++ .../exception/InvalidBotCodeException.java | 39 +++++++++++++++++ .../UnsupportedBotCodeException.java | 36 ++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/BuildBotCodeException.java create mode 100644 ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/InvalidBotCodeException.java create mode 100644 ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/UnsupportedBotCodeException.java diff --git a/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/BuildBotCodeException.java b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/BuildBotCodeException.java new file mode 100644 index 0000000..5ce7b65 --- /dev/null +++ b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/BuildBotCodeException.java @@ -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 . + */ + +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); + } +} diff --git a/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/InvalidBotCodeException.java b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/InvalidBotCodeException.java new file mode 100644 index 0000000..d1a3995 --- /dev/null +++ b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/InvalidBotCodeException.java @@ -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 . + */ + +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); + } +} diff --git a/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/UnsupportedBotCodeException.java b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/UnsupportedBotCodeException.java new file mode 100644 index 0000000..f2e6131 --- /dev/null +++ b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/UnsupportedBotCodeException.java @@ -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 . + */ + +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); + } +}