From 97c3a4b8f369a3563a3b032e5ebd7e704288cf7e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 27 Oct 2020 16:21:08 +0100 Subject: [PATCH] store error when loading encrypted images --- .../session/room/timeline/tiles/ImageTile.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/domain/session/room/timeline/tiles/ImageTile.js b/src/domain/session/room/timeline/tiles/ImageTile.js index 27e68250..e86902d9 100644 --- a/src/domain/session/room/timeline/tiles/ImageTile.js +++ b/src/domain/session/room/timeline/tiles/ImageTile.js @@ -24,6 +24,7 @@ export class ImageTile extends MessageTile { super(options); this._decryptedThumbail = null; this._decryptedImage = null; + this._error = null; this.load(); } @@ -36,14 +37,18 @@ export class ImageTile extends MessageTile { } async load() { - const thumbnailFile = this._getContent().info?.thumbnail_file; - const file = this._getContent().file; - if (thumbnailFile) { - this._decryptedThumbail = await this._loadEncryptedFile(thumbnailFile); - this.emitChange("thumbnailUrl"); - } else if (file) { - this._decryptedImage = await this._loadEncryptedFile(file); - this.emitChange("thumbnailUrl"); + try { + const thumbnailFile = this._getContent().info?.thumbnail_file; + const file = this._getContent().file; + if (thumbnailFile) { + this._decryptedThumbail = await this._loadEncryptedFile(thumbnailFile); + this.emitChange("thumbnailUrl"); + } else if (file) { + this._decryptedImage = await this._loadEncryptedFile(file); + this.emitChange("thumbnailUrl"); + } + } catch (err) { + this._error = err; } }