Skip to content

Commit

Permalink
Merge pull request #12358 from ashera96/api-chat
Browse files Browse the repository at this point in the history
Fix error flow error message propagate issue
  • Loading branch information
ashera96 authored Mar 23, 2024
2 parents 6984829 + 5f6c0ca commit 4135f91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10440,10 +10440,10 @@ public static String invokeAIService(String endpointConfigName, String authToken
if (statusCode == HttpStatus.SC_CREATED) {
return responseStr;
} else if (statusCode == HttpStatus.SC_UNAUTHORIZED) {
throw new APIManagementException("Unexpected response detected from the AI service." + responseStr,
throw new APIManagementException("Unexpected response detected from the AI service. " + responseStr,
ExceptionCodes.AI_SERVICE_INVALID_ACCESS_TOKEN);
} else {
throw new APIManagementException("Unexpected response detected from the AI service." + responseStr,
throw new APIManagementException("Unexpected response detected from the AI service. " + responseStr,
ExceptionCodes.AI_SERVICE_INVALID_RESPONSE);
}
} catch (MalformedURLException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ public Response apiChatPost(String apiId, String apiChatAction, ApiChatRequestDT
ApiChatResponseDTO.class);
return Response.status(Response.Status.CREATED).entity(preparationResponseDTO).build();
} catch (APIManagementException | IOException e) {
String errorMessage = "Error encountered while executing the prepare statement of API Chat service";
String errorMessage = "Error encountered while executing the prepare statement of API Chat " +
"service. Cause: " + e.getCause().getMessage();
RestApiUtil.handleInternalServerError(errorMessage, e, log);
}

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

0 comments on commit 4135f91

Please sign in to comment.