error checking
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,5 +1,3 @@
|
||||
.vscode
|
||||
main
|
||||
pdwebconfig.toml
|
||||
res/static/res/script/pixellib.js
|
||||
res/static/res/script/home.js
|
||||
pdwebconfig.toml
|
@@ -29,6 +29,11 @@ var UploadProgressBar = /** @class */ (function () {
|
||||
+ this.file.name + '<br/>'
|
||||
+ '<span style="color: var(--highlight_color);">' + window.location.hostname + '/u/' + id + '</span>');
|
||||
};
|
||||
UploadProgressBar.prototype.onFailure = function (response, error) {
|
||||
this.uploadDiv.setAttribute('style', 'background: #821C40');
|
||||
this.uploadDivJQ.html(this.file.name + '<br/>'
|
||||
+ 'Upload failed after three tries!');
|
||||
};
|
||||
return UploadProgressBar;
|
||||
}());
|
||||
function handleUploads(files) {
|
||||
@@ -182,6 +187,8 @@ var UploadWorker = /** @class */ (function () {
|
||||
if (that.tries === 3) {
|
||||
alert("Upload failed: " + status);
|
||||
that.uploading = false;
|
||||
file.onFailure(status, error);
|
||||
that.start(); // Try to continue
|
||||
return; // Upload failed
|
||||
}
|
||||
// Try again
|
||||
|
@@ -47,6 +47,13 @@ class UploadProgressBar implements FileUpload {
|
||||
+ '<span style="color: var(--highlight_color);">'+window.location.hostname+'/u/'+id+'</span>'
|
||||
)
|
||||
}
|
||||
public onFailure(response: JQuery.Ajax.ErrorTextStatus, error: string) {
|
||||
this.uploadDiv.setAttribute('style', 'background: #821C40')
|
||||
this.uploadDivJQ.html(
|
||||
this.file.name+'<br/>'
|
||||
+ 'Upload failed after three tries!'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function handleUploads(files: FileList) {
|
||||
|
@@ -2,6 +2,7 @@ interface FileUpload {
|
||||
file: File
|
||||
onProgress(progress: number)
|
||||
onFinished(id: string)
|
||||
onFailure(response: JQuery.Ajax.ErrorTextStatus, error: string)
|
||||
}
|
||||
|
||||
class UploadManager {
|
||||
@@ -100,6 +101,9 @@ class UploadWorker {
|
||||
if (that.tries === 3) {
|
||||
alert("Upload failed: " + status);
|
||||
that.uploading = false
|
||||
file.onFailure(status, error)
|
||||
|
||||
that.start() // Try to continue
|
||||
return; // Upload failed
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user