refactor(exception)!: 重构多类型异常接口

- 在 IMultiTypesException 接口中添加泛型参数 TCode,用于指定异常类型代码的类型
- 在 IExceptionType 接口中添加 getDescription 方法,用于获取异常类型的描述信息
This commit is contained in:
2025-06-09 16:24:06 +08:00
parent ce56f297f3
commit f4e3684a3f
5 changed files with 23 additions and 14 deletions

View File

@@ -77,7 +77,7 @@ System.out.println(result); // Output: Return string
```java
public final class LoginException
extends RuntimeException
implements IMultiTypesException<LoginException, LoginException.Type> {
implements IMultiTypesException<LoginException, String, LoginException.Type> {
private final Type type;
private LoginException(@Nonnull Type type, @Nonnull String message) {
super(message);
@@ -103,7 +103,7 @@ public final class LoginException
// ...
public enum Type implements IExceptionType<LoginException> {
public enum Type implements IExceptionType<LoginException, String> {
DEFAULT("00", "当前会话未登录"),
NOT_TOKEN("10", "未提供token"),
INVALID_TOKEN("20", "token无效"),