I'm currently working with an Ajax object that is utilized in various other objects to load 'Json' files.
One issue I'm facing is trying to catch the 404 'Not found' exception thrown in the initializer object. However, every attempt results in:
Uncaught Exception : *********
Here is a snippet of the code in question:
_ajax_params.xmlhttp.onreadystatechange = function() {
if (_ajax_params.xmlhttp.readyState==4 && _ajax_params.xmlhttp.status==200) {
_ajax_params.response = _ajax_params.xmlhttp.responseText;
if (typeof afterClosure == 'function') {
afterClosure(_ajax_params.response);
}
COMMON.always(_ajax_params.response);
} else if (_ajax_params.xmlhttp.status == 404) {
throw 'File not found';
}
};
Within the initializer object:
try {
Base.include.json(url, 1);
} catch (e) {
console.error(e);
Base.include.json(url,2);
}
Despite attempting to re-throw the exception, I keep encountering the same issue.