Commit 8eabbc55 authored by Vaibhav's avatar Vaibhav
Browse files

Issue #SB-23374 fix : added error handler fucntion

Showing with 20 additions and 8 deletions
+20 -8
......@@ -416,6 +416,10 @@ const updateQuestion = (questionBody, createQuestionRes, callback) => {
if (updateResponseData.responseCode && _.toLower(updateResponseData.responseCode) === "ok") {
callback(null, updateResponseData);
} else {
updateResponse(
questionRes.result.identifier,
`Something Went wrong while updating the questions: ${JSON.stringify(updateResponseData)}`
);
callback(updateResponseData);
}
})
......@@ -423,6 +427,10 @@ const updateQuestion = (questionBody, createQuestionRes, callback) => {
logger.error({
message: `Error while updating the question :: ${JSON.stringify(error)}`,
});
updateResponse(
questionRes.result.identifier,
`Something Went wrong while updating the questions: ${JSON.stringify(error)}`
);
callback(error);
});
}
......@@ -450,6 +458,10 @@ const reviewQuestion = (status, questionRes, callback) => {
if (reviewResponseData.responseCode && _.toLower(reviewResponseData.responseCode) === "ok") {
callback(null, reviewResponseData);
} else {
updateResponse(
questionRes.result.identifier,
`Something Went wrong while reviewing the questions: ${JSON.stringify(reviewResponseData)}`
);
callback(reviewResponseData);
}
})
......@@ -459,7 +471,7 @@ const reviewQuestion = (status, questionRes, callback) => {
});
updateResponse(
questionRes.result.identifier,
`Something Went wrong while reviewing the questions: ${error}`
`Something Went wrong while reviewing the questions: ${JSON.stringify(error)}`
);
callback(error);
});
......@@ -486,6 +498,10 @@ const publishQuestion = (status, questionRes, callback) => {
if (publishResponseData.responseCode && _.toLower(publishResponseData.responseCode) === "ok") {
callback(null, publishResponseData);
} else {
updateResponse(
questionRes.result.identifier,
`Something went wrong while Publishing the question :: ${JSON.stringify(publishResponseData)}`
);
callback(publishResponseData);
}
})
......@@ -495,7 +511,7 @@ const publishQuestion = (status, questionRes, callback) => {
});
updateResponse(
questionRes.result.identifier,
`Something went wrong while Publishing the question`
`Something went wrong while Publishing the question :: ${JSON.stringify(error)}`
);
callback(error);
});
......@@ -526,10 +542,6 @@ const linkQuestionToQuestionSet = (questionData, questionRes, callback) => {
.then((response) => response.json())
.then((linkResponseData) => {
if (linkResponseData.responseCode && _.toLower(linkResponseData.responseCode) === "ok") {
// updateResponse(
// questionRes.result.identifier,
// `Successfully linked the question for the identifier:${questionRes.result.identifier}`
// );
console.log('Successfully linkQuestionToQuestionSet:: =====> ' , JSON.stringify(linkResponseData));
callback(null, linkResponseData);
} else {
......@@ -538,7 +550,7 @@ const linkQuestionToQuestionSet = (questionData, questionRes, callback) => {
});
updateResponse(
questionRes.result.identifier,
`Something went wrong while linking the question`
`Something went wrong while linking the question :: ${JSON.stringify(linkResponseData)}`
);
callback(linkResponseData);
}
......@@ -549,7 +561,7 @@ const linkQuestionToQuestionSet = (questionData, questionRes, callback) => {
});
updateResponse(
questionRes.result.identifier,
`Something went wrong while linking the question`
`Something went wrong while linking the question :: ${JSON.stringify(error)}`
);
callback(error);
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment