Fixing generic error
This commit is contained in:
13
dist/scorm-again.js
vendored
13
dist/scorm-again.js
vendored
File diff suppressed because one or more lines are too long
2
dist/scorm-again.js.map
vendored
2
dist/scorm-again.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/scorm-again.min.js
vendored
2
dist/scorm-again.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user