Fixing generic error

This commit is contained in:
Jonathan Putney
2019-11-19 14:00:58 -05:00
parent a23cf5557b
commit bb5e85d087
4 changed files with 16 additions and 13 deletions
+7 -6
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+7 -5
View File
@@ -862,6 +862,11 @@ export default class BaseAPI {
* @return {object} * @return {object}
*/ */
processHttpRequest(url: String, params) { processHttpRequest(url: String, params) {
const genericError = {
'result': global_constants.SCORM_FALSE,
'errorCode': this.#error_codes.GENERAL,
};
const httpReq = new XMLHttpRequest(); const httpReq = new XMLHttpRequest();
httpReq.open('POST', url, false); httpReq.open('POST', url, false);
try { try {
@@ -873,16 +878,13 @@ export default class BaseAPI {
httpReq.send(params); httpReq.send(params);
} }
} catch (e) { } catch (e) {
return { return genericError;
'result': global_constants.SCORM_FALSE,
'errorCode': this.#error_codes.GENERAL,
};
} }
try { try {
return JSON.parse(httpReq.responseText); return JSON.parse(httpReq.responseText);
} catch (e) { } catch (e) {
return {}; return genericError;
} }
} }