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