From 0b6f537354d100e4a5154b216501f6b2c2557084 Mon Sep 17 00:00:00 2001 From: LamGC Date: Sat, 17 Oct 2020 22:45:50 +0800 Subject: [PATCH] =?UTF-8?q?[Add][Fix]=20Framework-API=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=A4=E4=B8=AA=E5=BC=82=E5=B8=B8=E7=B1=BB?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Add] NoSuchSenderException, UploadImageException 添加两个与 MessageSender 相关的异常类; --- .../exception/NoSuchSenderException.java | 40 +++++++++++++++++ .../exception/UploadImageException.java | 43 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/NoSuchSenderException.java create mode 100644 ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/UploadImageException.java diff --git a/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/NoSuchSenderException.java b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/NoSuchSenderException.java new file mode 100644 index 0000000..aed99be --- /dev/null +++ b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/NoSuchSenderException.java @@ -0,0 +1,40 @@ +/* + * 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; + +/** + * 无对应 Sender 异常. + * 当 {@link net.lamgc.cgj.bot.framework.message.MessageSenderFactory} 无法返回对应 Sender 时抛出. + * @see net.lamgc.cgj.bot.framework.message.MessageSender + * @see net.lamgc.cgj.bot.framework.message.MessageSenderFactory + * @author LamGC + */ +public class NoSuchSenderException extends Exception { + + public NoSuchSenderException(String message) { + super(message); + } + + public NoSuchSenderException(String message, Throwable cause) { + super(message, cause); + } + + public NoSuchSenderException(Throwable cause) { + super(cause); + } +} diff --git a/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/UploadImageException.java b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/UploadImageException.java new file mode 100644 index 0000000..3788d5b --- /dev/null +++ b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/message/exception/UploadImageException.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 java.io.File; + +/** + * 图片上传异常. + * 当图片上传发生异常时抛出, 需附带原因. + * @author LamGC + * @see net.lamgc.cgj.bot.framework.message.MessageSender + * @see net.lamgc.cgj.bot.framework.message.MessageSender#uploadImage(File) + * @see net.lamgc.cgj.bot.framework.message.MessageSender#uploadImage(java.io.InputStream) + */ +public class UploadImageException extends Exception { + + public UploadImageException(String message) { + super(message); + } + + public UploadImageException(String message, Throwable cause) { + super(message, cause); + } + + public UploadImageException(Throwable cause) { + super(cause); + } +}