fix exception

This commit is contained in:
Looly
2024-08-11 16:29:10 +08:00
parent 1062caceea
commit 884ba3350f
8 changed files with 383 additions and 88 deletions

View File

@@ -12,38 +12,74 @@
package org.dromara.hutool.extra.ftp;
import org.dromara.hutool.core.exception.ExceptionUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.exception.HutoolException;
/**
* Ftp异常
*
* @author Looly
*/
public class FtpException extends RuntimeException {
private static final long serialVersionUID = -8490149159895201756L;
public class FtpException extends HutoolException {
private static final long serialVersionUID = 1L;
/**
* 构造
*
* @param e 异常
*/
public FtpException(final Throwable e) {
super(ExceptionUtil.getMessage(e), e);
super(e);
}
/**
* 构造
*
* @param message 消息
*/
public FtpException(final String message) {
super(message);
}
/**
* 构造
*
* @param messageTemplate 消息模板
* @param params 参数
*/
public FtpException(final String messageTemplate, final Object... params) {
super(StrUtil.format(messageTemplate, params));
super(messageTemplate, params);
}
public FtpException(final String message, final Throwable throwable) {
super(message, throwable);
/**
* 构造
*
* @param message 消息
* @param cause 被包装的子异常
*/
public FtpException(final String message, final Throwable cause) {
super(message, cause);
}
public FtpException(final String message, final Throwable throwable, final boolean enableSuppression, final boolean writableStackTrace) {
super(message, throwable, enableSuppression, writableStackTrace);
/**
* 构造
*
* @param message 消息
* @param cause 被包装的子异常
* @param enableSuppression 是否启用抑制
* @param writableStackTrace 堆栈跟踪是否应该是可写的
*/
public FtpException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public FtpException(final Throwable throwable, final String messageTemplate, final Object... params) {
super(StrUtil.format(messageTemplate, params), throwable);
/**
* 构造
*
* @param cause 被包装的子异常
* @param messageTemplate 消息模板
* @param params 参数
*/
public FtpException(final Throwable cause, final String messageTemplate, final Object... params) {
super(cause, messageTemplate, params);
}
}

View File

@@ -12,37 +12,74 @@
package org.dromara.hutool.extra.mail;
import org.dromara.hutool.core.exception.ExceptionUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.exception.HutoolException;
/**
* 邮件异常
*
* @author Looly
*/
public class MailException extends RuntimeException{
private static final long serialVersionUID = 8247610319171014183L;
public class MailException extends HutoolException {
private static final long serialVersionUID = 1L;
/**
* 构造
*
* @param e 异常
*/
public MailException(final Throwable e) {
super(ExceptionUtil.getMessage(e), e);
super(e);
}
/**
* 构造
*
* @param message 消息
*/
public MailException(final String message) {
super(message);
}
/**
* 构造
*
* @param messageTemplate 消息模板
* @param params 参数
*/
public MailException(final String messageTemplate, final Object... params) {
super(StrUtil.format(messageTemplate, params));
super(messageTemplate, params);
}
public MailException(final String message, final Throwable throwable) {
super(message, throwable);
/**
* 构造
*
* @param message 消息
* @param cause 被包装的子异常
*/
public MailException(final String message, final Throwable cause) {
super(message, cause);
}
public MailException(final String message, final Throwable throwable, final boolean enableSuppression, final boolean writableStackTrace) {
super(message, throwable, enableSuppression, writableStackTrace);
/**
* 构造
*
* @param message 消息
* @param cause 被包装的子异常
* @param enableSuppression 是否启用抑制
* @param writableStackTrace 堆栈跟踪是否应该是可写的
*/
public MailException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public MailException(final Throwable throwable, final String messageTemplate, final Object... params) {
super(StrUtil.format(messageTemplate, params), throwable);
/**
* 构造
*
* @param cause 被包装的子异常
* @param messageTemplate 消息模板
* @param params 参数
*/
public MailException(final Throwable cause, final String messageTemplate, final Object... params) {
super(cause, messageTemplate, params);
}
}

View File

@@ -12,38 +12,74 @@
package org.dromara.hutool.extra.management;
import org.dromara.hutool.core.exception.ExceptionUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.exception.HutoolException;
/**
* FtpException异常
*
* @author Looly
*/
public class ManagementException extends RuntimeException {
public class ManagementException extends HutoolException {
private static final long serialVersionUID = 1L;
/**
* 构造
*
* @param e 异常
*/
public ManagementException(final Throwable e) {
super(ExceptionUtil.getMessage(e), e);
super(e);
}
/**
* 构造
*
* @param message 消息
*/
public ManagementException(final String message) {
super(message);
}
/**
* 构造
*
* @param messageTemplate 消息模板
* @param params 参数
*/
public ManagementException(final String messageTemplate, final Object... params) {
super(StrUtil.format(messageTemplate, params));
super(messageTemplate, params);
}
public ManagementException(final String message, final Throwable throwable) {
super(message, throwable);
/**
* 构造
*
* @param message 消息
* @param cause 被包装的子异常
*/
public ManagementException(final String message, final Throwable cause) {
super(message, cause);
}
public ManagementException(final String message, final Throwable throwable, final boolean enableSuppression, final boolean writableStackTrace) {
super(message, throwable, enableSuppression, writableStackTrace);
/**
* 构造
*
* @param message 消息
* @param cause 被包装的子异常
* @param enableSuppression 是否启用抑制
* @param writableStackTrace 堆栈跟踪是否应该是可写的
*/
public ManagementException(final String message, final Throwable cause, final boolean enableSuppression, final boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public ManagementException(final Throwable throwable, final String messageTemplate, final Object... params) {
super(StrUtil.format(messageTemplate, params), throwable);
/**
* 构造
*
* @param cause 被包装的子异常
* @param messageTemplate 消息模板
* @param params 参数
*/
public ManagementException(final Throwable cause, final String messageTemplate, final Object... params) {
super(cause, messageTemplate, params);
}
}