From 30b6392ce2173dbbc8182f8ad136ca44ae635186 Mon Sep 17 00:00:00 2001 From: LamGC Date: Mon, 1 Mar 2021 09:14:13 +0800 Subject: [PATCH] =?UTF-8?q?[Add]=20Framework-API=20=E4=B8=BA=20NotFoundSen?= =?UTF-8?q?derException=20=E5=BC=82=E5=B8=B8=E6=B7=BB=E5=8A=A0=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E6=9E=84=E9=80=A0=E5=99=A8(=E6=97=A9=E7=9F=A5?= =?UTF-8?q?=E9=81=93=E5=B0=B1=E4=B8=80=E6=AD=A5=E5=88=B0=E4=BD=8D=E4=BA=86?= =?UTF-8?q?=20:O);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Add] NotFoundSenderException 添加新的构造器; --- .../framework/NotFoundSenderException.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/NotFoundSenderException.java b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/NotFoundSenderException.java index 6567ea7..781301c 100644 --- a/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/NotFoundSenderException.java +++ b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/NotFoundSenderException.java @@ -36,7 +36,7 @@ public class NotFoundSenderException extends RuntimeException { * @param id 传入的消息源 Id. */ public NotFoundSenderException(MessageSource source, long id) { - this(source, id, null); + this(source, id, (String) null); } /** @@ -52,6 +52,30 @@ public class NotFoundSenderException extends RuntimeException { this.id = id; } + /** + * 构造异常. + * @param source 传入的消息源类型. + * @param id 传入的消息源 Id. + */ + public NotFoundSenderException(MessageSource source, long id, Throwable cause) { + super("Source Type: " + source + ", id: " + id, cause); + this.source = source; + this.id = id; + } + + /** + * 构造异常. + * @param source 传入的消息源类型. + * @param id 传入的消息源 Id. + */ + public NotFoundSenderException(MessageSource source, long id, String message, Throwable cause) { + super(Strings.isNullOrEmpty(message) ? + "Source Type: " + source + ", id: " + id : + message + " (" + "Source Type: " + source + ", id: " + id + ")", cause); + this.source = source; + this.id = id; + } + /** * 获取引发该异常时传入的 {@link MessageSource} 类型. * @return 返回引发该异常时提供的 MessageSource.