improve error message

This commit is contained in:
2020-01-31 21:02:37 +01:00
parent 63cbfaaf4f
commit ee3829d054
2 changed files with 10 additions and 5 deletions

View File

@@ -54,13 +54,18 @@ UploadProgressBar.prototype.onFinished = function(id){
this.uploadDiv.appendChild(linkSpan)
}
UploadProgressBar.prototype.onFailure = function(val, msg) {
if (val === "") {
val = "Could not connect to server";
}
this.uploadDiv.innerHTML = "" // Remove uploading progress
this.uploadDiv.style.background = 'var(--danger_color)'
this.uploadDiv.style.color = 'var(--highlight_text_color)'
this.uploadDiv.appendChild(document.createTextNode("Upload failed: "))
this.uploadDiv.appendChild(document.createTextNode(msg+" ("+val+")"))
this.uploadDiv.appendChild(document.createElement("br"))
this.uploadDiv.appendChild(document.createTextNode(this.file.name))
this.uploadDiv.appendChild(document.createElement("br"))
this.uploadDiv.appendChild(document.createTextNode("Upload failed after three tries:"))
this.uploadDiv.appendChild(document.createElement("br"))
this.uploadDiv.appendChild(document.createTextNode(val))
console.log(msg);
}