diff --git a/extensions/data-plane/data-plane-public-api-v2/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/DataPlanePublicApiV2Controller.java b/extensions/data-plane/data-plane-public-api-v2/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/DataPlanePublicApiV2Controller.java index 5a3e47b6abc..c54e8b54e09 100644 --- a/extensions/data-plane/data-plane-public-api-v2/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/DataPlanePublicApiV2Controller.java +++ b/extensions/data-plane/data-plane-public-api-v2/src/main/java/org/eclipse/edc/connector/dataplane/api/controller/DataPlanePublicApiV2Controller.java @@ -66,8 +66,8 @@ public DataPlanePublicApiV2Controller(PipelineService pipelineService, this.executorService = executorService; } - private static Response error(Response.Status status, String error) { - return status(status).type(APPLICATION_JSON).entity(new TransferErrorResponse(List.of(error))).build(); + private static Response error(Response.Status status, List errors) { + return status(status).type(APPLICATION_JSON).entity(new TransferErrorResponse(errors)).build(); } @GET @@ -135,13 +135,13 @@ private void handle(ContainerRequestContext requestContext, AsyncResponse respon var token = contextApi.headers().get(HttpHeaders.AUTHORIZATION); if (token == null) { - response.resume(error(UNAUTHORIZED, "Missing Authorization Header")); + response.resume(error(UNAUTHORIZED, List.of("Missing Authorization Header"))); return; } var sourceDataAddress = authorizationService.authorize(token, buildRequestData(requestContext)); if (sourceDataAddress.failed()) { - response.resume(error(FORBIDDEN, sourceDataAddress.getFailureDetail())); + response.resume(error(FORBIDDEN, sourceDataAddress.getFailureMessages())); return; } @@ -173,11 +173,11 @@ private void processRequest(DataFlowStartMessage dataFlowStartMessage, AsyncResp .whenComplete((result, throwable) -> { if (throwable == null) { if (result.failed()) { - response.resume(error(INTERNAL_SERVER_ERROR, result.getFailureDetail())); + response.resume(error(INTERNAL_SERVER_ERROR, result.getFailureMessages())); } } else { var error = "Unhandled exception occurred during data transfer: " + throwable.getMessage(); - response.resume(error(INTERNAL_SERVER_ERROR, error)); + response.resume(error(INTERNAL_SERVER_ERROR, List.of(error))); } }); }