Skip to content

Commit

Permalink
Merge pull request #12333 from Lakith-Rambukkanage/vMaster-add-doc-er…
Browse files Browse the repository at this point in the history
…ror-improve

Improve error returned by backend for existing api docs
  • Loading branch information
tgtshanika authored Mar 19, 2024
2 parents cc6bd81 + 1e05d9f commit 8d8bc2f
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,8 @@ public Response getAPIDocuments(String apiId, Integer limit, Integer offset, Str
* @return created document DTO as response
*/
@Override
public Response addAPIDocument(String apiId, DocumentDTO body, String ifMatch, MessageContext messageContext) {
public Response addAPIDocument(String apiId, DocumentDTO body, String ifMatch, MessageContext messageContext)
throws APIManagementException {
try {
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();
//validate if api exists
Expand All @@ -1600,8 +1601,8 @@ public Response addAPIDocument(String apiId, DocumentDTO body, String ifMatch, M
.handleAuthorizationFailure("Authorization failure while adding documents of API : " + apiId, e,
log);
} else {
String errorMessage = "Error while adding the document for API : " + apiId;
RestApiUtil.handleInternalServerError(errorMessage, e, log);
throw new APIManagementException(
"Error while adding a new document to API " + apiId + " : " + e.getMessage(), e);
}
} catch (URISyntaxException e) {
String errorMessage = "Error while retrieving location for document " + body.getName() + " of API " + apiId;
Expand Down

0 comments on commit 8d8bc2f

Please sign in to comment.