I'm trying to kill the upload as soon as an exception occurs. The "fileuploadchunkdone" event handler allows me to capture the "error" json sent from the server for every single chunk. Ideally, I would like to abort the upload as soon as an exception occurs. I need to do this check for every chunk since I need to log the error and display the error code when the exception occurs. However, I am not able to kill the exception by calling data.jqXHR.abort(). It just continues going through every chunk. Any ideas? Here is the code for that event handler:
.on('fileuploadchunkdone', function (e, data) {
if (!data.result.success) {
running--;
var errMsg = "";
if (data.result != null) {
if (data.result.message != null) {
errMsg += data.result.message;
}
if (data.result.error != null)
errMsg += data.result.error;
}
layoutService.showErrorDialog(errMsg);
data.jqXHR = data.abort();
window.removeXHRfromPool(data);
if (running == 0) {
$('#dlgProgress').parent().hide();
$('#progresses').empty();
}
}
})