handle upload failures better

This commit is contained in:
Bruno Windels 2020-11-11 13:06:03 +01:00
parent d477be2b41
commit 8b16d8bc99
2 changed files with 8 additions and 2 deletions

View file

@ -25,7 +25,7 @@ export class FileTile extends MessageTile {
this._downloading = false; this._downloading = false;
if (this._isUploading) { if (this._isUploading) {
// should really do this with an ObservableValue and waitFor to prevent leaks when the promise never resolves // should really do this with an ObservableValue and waitFor to prevent leaks when the promise never resolves
this._entry.attachment.uploaded().then(() => { this._entry.attachment.uploaded().finally(() => {
if (!this.isDisposed) { if (!this.isDisposed) {
this.emitChange("label"); this.emitChange("label");
} }

View file

@ -53,7 +53,13 @@ export class SendQueue {
} }
if (pendingEvent.attachment) { if (pendingEvent.attachment) {
const {attachment} = pendingEvent; const {attachment} = pendingEvent;
await attachment.uploaded(); try {
await attachment.uploaded();
} catch (err) {
console.log("upload failed, skip sending message", pendingEvent);
this._amountSent += 1;
continue;
}
attachment.applyToContent(pendingEvent.content); attachment.applyToContent(pendingEvent.content);
} }
if (pendingEvent.needsEncryption) { if (pendingEvent.needsEncryption) {