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.