Skip to content

Commit

Permalink
Update campaignApis.ts (#924)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-egov committed Jun 18, 2024
1 parent 2e480e6 commit 1ebc6c5
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions utilities/project-factory/src/server/api/campaignApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,17 +745,29 @@ async function processGenericRequest(request: any, localizationMap?: { [key: str
}

async function handleResouceDetailsError(request: any, error: any) {
var stringifiedError: any;
if (error?.description || error?.message) {
stringifiedError = JSON.stringify({
status: error.status || '',
code: error.code || '',
description: error.description || '',
message: error.message || ''
});
}
else {
if (typeof error == "object")
stringifiedError = JSON.stringify(error);
else {
stringifiedError = error
}
}

logger.error("Error while processing after validation : " + error)
if (request?.body?.ResourceDetails) {
request.body.ResourceDetails.status = "failed";
request.body.ResourceDetails.additionalDetails = {
...request?.body?.ResourceDetails?.additionalDetails,
error: JSON.stringify({
status: error.status || '',
code: error.code || '',
description: error.description || '',
message: error.message || ''
})
error: stringifiedError
};
const persistMessage: any = { ResourceDetails: request.body.ResourceDetails }
if (request?.body?.ResourceDetails?.action == "create") {
Expand Down

0 comments on commit 1ebc6c5

Please sign in to comment.