1
0
mirror of https://github.com/vector-im/hydrogen-web.git synced 2025-01-10 20:17:32 +01:00

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
src
domain/session/room/timeline/tiles
matrix/room/sending

@ -25,7 +25,7 @@ export class FileTile extends MessageTile {
this._downloading = false;
if (this._isUploading) {
// 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) {
this.emitChange("label");
}

@ -53,7 +53,13 @@ export class SendQueue {
}
if (pendingEvent.attachment) {
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);
}
if (pendingEvent.needsEncryption) {