refactor(core): migrate deprecated exceptions to new hierarchy and align tests

This commit is contained in:
2026-04-11 16:10:34 +08:00
parent b8cb2afbcf
commit 1b48e955bd
28 changed files with 414 additions and 175 deletions

View File

@@ -1,12 +0,0 @@
package work.slhaf.partner.framework.agent.exception.deprecated;
@Deprecated
public class AgentLaunchFailedException extends RuntimeException {
public AgentLaunchFailedException(String message, Throwable cause) {
super("Agent 启动失败 " + message, cause);
}
public AgentLaunchFailedException(String message) {
super("Agent 启动失败 " + message);
}
}

View File

@@ -1,12 +0,0 @@
package work.slhaf.partner.framework.agent.exception.deprecated;
@Deprecated
public class AgentRunningFailedException extends AgentRuntimeException {
public AgentRunningFailedException(String message) {
super(message);
}
public AgentRunningFailedException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@@ -1,12 +0,0 @@
package work.slhaf.partner.framework.agent.exception.deprecated;
@Deprecated
public class AgentRuntimeException extends RuntimeException {
public AgentRuntimeException(String message) {
super("Agent 执行出错 " + message);
}
public AgentRuntimeException(String message, Throwable cause) {
super("Agent 执行出错 " + message, cause);
}
}

View File

@@ -21,9 +21,8 @@ class Result<T> private constructor(
return value as T
}
when (exception) {
is RuntimeException -> throw exception
is Error -> throw exception
else -> throw IllegalStateException(exception.message, exception)
is AgentRuntimeException, is Error -> throw exception
else -> throw AgentRuntimeException(exception.localizedMessage, exception)
}
}