[Add] Framework-API 为 NotFoundSenderException 异常添加新的构造器(早知道就一步到位了 :O);

[Add] NotFoundSenderException 添加新的构造器;
This commit is contained in:
LamGC 2021-03-01 09:14:13 +08:00
parent e494412344
commit 30b6392ce2
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -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.