Skip to content

Commit 5f6c0ca

Browse files
committed
Fix error flow error message propagate issue
1 parent b9053a0 commit 5f6c0ca

File tree

2 files changed

+5
-4
lines changed
  • components/apimgt
    • org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils
    • org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/impl

2 files changed

+5
-4
lines changed

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -10426,10 +10426,10 @@ public static String invokeAIService(String endpointConfigName, String authToken
1042610426
if (statusCode == HttpStatus.SC_CREATED) {
1042710427
return responseStr;
1042810428
} else if (statusCode == HttpStatus.SC_UNAUTHORIZED) {
10429-
throw new APIManagementException("Unexpected response detected from the AI service." + responseStr,
10429+
throw new APIManagementException("Unexpected response detected from the AI service. " + responseStr,
1043010430
ExceptionCodes.AI_SERVICE_INVALID_ACCESS_TOKEN);
1043110431
} else {
10432-
throw new APIManagementException("Unexpected response detected from the AI service." + responseStr,
10432+
throw new APIManagementException("Unexpected response detected from the AI service. " + responseStr,
1043310433
ExceptionCodes.AI_SERVICE_INVALID_RESPONSE);
1043410434
}
1043510435
} catch (MalformedURLException e) {

components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/impl/ApisApiServiceImpl.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ public Response apiChatPost(String apiId, String apiChatAction, ApiChatRequestDT
293293
ApiChatResponseDTO.class);
294294
return Response.status(Response.Status.CREATED).entity(preparationResponseDTO).build();
295295
} catch (APIManagementException | IOException e) {
296-
String errorMessage = "Error encountered while executing the prepare statement of API Chat service";
296+
String errorMessage = "Error encountered while executing the prepare statement of API Chat " +
297+
"service. Cause: " + e.getCause().getMessage();
297298
RestApiUtil.handleInternalServerError(errorMessage, e, log);
298299
}
299300

@@ -360,7 +361,7 @@ public Response apiChatPost(String apiId, String apiChatAction, ApiChatRequestDT
360361
return Response.status(Response.Status.CREATED).entity(responseDTO).build();
361362
} catch (APIManagementException | IOException e) {
362363
String errorMessage = "Error encountered while executing the API Chat service to accommodate the " +
363-
"specified testing requirement";
364+
"specified testing requirement. Cause: " + e.getCause().getMessage();
364365
RestApiUtil.handleInternalServerError(errorMessage, e, log);
365366
}
366367
} else {

0 commit comments

Comments
 (0)