Add error message from server when voting

This commit is contained in:
Ajay Ramachandran
2021-01-26 21:57:43 -05:00
parent 41fee58ab9
commit 67f2798672
4 changed files with 15 additions and 11 deletions

View File

@@ -286,8 +286,9 @@ class Utils {
* @param {int} statusCode
* @returns {string} errorMessage
*/
getErrorMessage(statusCode: number): string {
getErrorMessage(statusCode: number, responseText: string): string {
let errorMessage = "";
const postFix = (responseText ? "\n\n" + responseText : "");
if([400, 429, 409, 502, 0].includes(statusCode)) {
//treat them the same
@@ -299,7 +300,7 @@ class Utils {
errorMessage = chrome.i18n.getMessage("connectionError") + statusCode;
}
return errorMessage;
return errorMessage + postFix;
}
/**