完成 M002 V3 CP6 P0 fixtures 回归基线
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package cn.nianxx.thhotel.integrations.ai.superagent.common.result;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SuperAgent V3 基础设施输入错误响应。用于 source_message.source_message_id 缺失等调用层错误,
|
||||
* 不使用通用错误包装,保持 0711 P0 契约的扁平结构。
|
||||
*/
|
||||
public record SuperAgentTaskResultInfrastructureInputErrorResponse(
|
||||
@JsonProperty("result_type")
|
||||
String resultType,
|
||||
@JsonProperty("error_code")
|
||||
String errorCode,
|
||||
Boolean retryable,
|
||||
@JsonProperty("missing_fields")
|
||||
List<String> missingFields
|
||||
) {
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.nianxx.thhotel.integrations.ai.superagent.control;
|
||||
|
||||
import cn.nianxx.thhotel.integrations.ai.superagent.common.result.SuperAgentTaskResultErrorResponse;
|
||||
import cn.nianxx.thhotel.integrations.ai.superagent.common.result.SuperAgentTaskResultInfrastructureInputErrorResponse;
|
||||
import cn.nianxx.thhotel.integrations.ai.superagent.service.impl.SuperAgentTaskResultException;
|
||||
import cn.nianxx.thhotel.platform.hotel.service.HotelContextException;
|
||||
import cn.nianxx.thhotel.workflows.reservation.service.impl.ReservationAiTaskIntakeException;
|
||||
@@ -29,8 +30,16 @@ public class SuperAgentTaskResultControllerAdvice {
|
||||
* 处理 Reservation 接收阶段的 SourceMessage、幂等和 AI item 技术校验异常。
|
||||
*/
|
||||
@ExceptionHandler(ReservationAiTaskIntakeException.class)
|
||||
public ResponseEntity<SuperAgentTaskResultErrorResponse> handleIntakeException(
|
||||
public ResponseEntity<?> handleIntakeException(
|
||||
ReservationAiTaskIntakeException exception) {
|
||||
if ("MISSING_SOURCE_MESSAGE_ID".equals(exception.getErrorCode())) {
|
||||
return ResponseEntity.status(exception.getStatus())
|
||||
.body(new SuperAgentTaskResultInfrastructureInputErrorResponse(
|
||||
"infrastructure_input_error",
|
||||
"missing_source_message_id",
|
||||
true,
|
||||
List.of("source_message.source_message_id")));
|
||||
}
|
||||
return ResponseEntity.status(exception.getStatus())
|
||||
.body(error(exception.getErrorCode(), exception.getMessage()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user