summaryrefslogtreecommitdiff
path: root/www/js/importer.js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-14 00:24:43 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-14 00:25:00 (GMT)
commit8950c5830665de3c20a0d142f69f8bd33ef74183 (patch)
treee66b462f56a52191bbb3ea306a7fd4ec68435307 /www/js/importer.js
parent3dde5e42704bb5633827f0b7ba4a403d98365c22 (diff)
import errors are now somehow handled - still needs love
Diffstat (limited to 'www/js/importer.js')
-rw-r--r--www/js/importer.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/www/js/importer.js b/www/js/importer.js
index 1da9d1a..c813f1a 100644
--- a/www/js/importer.js
+++ b/www/js/importer.js
@@ -338,7 +338,7 @@ Rdxport.Upload.prototype.onerror = function(error) {
var file = {
cartNumber: this.cartNumber || this.newCartNumber
};
- this.importFileUploadError(file, error);
+ this.importFileUploadError(file, 500, error);
};
Rdxport.Upload.prototype.onmessage = function(event) {
@@ -350,7 +350,7 @@ Rdxport.Upload.prototype.onmessage = function(event) {
switch (data.TYPE.toLowerCase()) {
case Rdxport.Importer.TYPE_ERROR:
console.log(data);
- this.importFileUploadError(file, data.ERROR_STRING);
+ this.importFileUploadError(file, data.RESPONSE_CODE, data.ERROR_STRING);
break;
case Rdxport.Importer.TYPE_PROGRESS:
this.uploadprogress.current = data.CURRENT;
@@ -362,7 +362,11 @@ Rdxport.Upload.prototype.onmessage = function(event) {
break;
case Rdxport.Importer.TYPE_DONE:
console.log(data);
- this.importFileUploadSuccess();
+ if(data.RESPONSE_CODE < 400) {
+ this.importFileUploadSuccess();
+ } else {
+ this.importFileUploadError(file, data.RESPONSE_CODE, data.ERROR_STRING);
+ }
break;
}
@@ -472,9 +476,9 @@ Rdxport.Upload.prototype.importFileUploadSuccess = function() {
this.group.fetchCarts();
};
-Rdxport.Upload.prototype.importFileUploadError = function(file, msg, xhr) {
+Rdxport.Upload.prototype.importFileUploadError = function(file, status, errorString) {
var self = this;
- this.groupView.uploadError(this, file, msg, xhr, function() {
+ this.groupView.uploadError(this, file, status, errorString, function() {
self.cancel();
});
};