diff options
author | Vinicius Reis <vinicius.reis@nextcloud.com> | 2022-06-06 23:34:10 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2022-06-09 11:35:38 +0300 |
commit | 5abdf58b4843bd8c51e81b05f3cd5e738f205e74 (patch) | |
tree | 964b3bad08cca84be41a85bdbba63138e7bee33c /src/nodes | |
parent | a54c52dde7ba28798e7a339f16e99c409428f080 (diff) |
✨ (#2463): emit error when image loading fails
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
Diffstat (limited to 'src/nodes')
-rw-r--r-- | src/nodes/ImageView.vue | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nodes/ImageView.vue b/src/nodes/ImageView.vue index 7d2f8689d..71939b9e7 100644 --- a/src/nodes/ImageView.vue +++ b/src/nodes/ImageView.vue @@ -121,7 +121,7 @@ const getQueryVariable = (src, variable) => { } } -class ErrorLoadImage extends Error { +class LoadImageError extends Error { constructor(reason, imageUrl) { super(reason?.message || t('text', 'Failed to load')) @@ -245,7 +245,7 @@ export default { resolve(imageUrl) } img.onerror = (e) => { - reject(new ErrorLoadImage(e, imageUrl)) + reject(new LoadImageError(e, imageUrl)) } img.src = imageUrl }) @@ -256,9 +256,11 @@ export default { this.loaded = true this.errorMessage = err.message - if (err instanceof ErrorLoadImage) { + if (err instanceof LoadImageError) { this.errorMessage = `${this.errorMessage} [${this.src}]` } + + this.$emit('error', { error: err, src: this.src }) }, updateAlt(event) { this.updateAttributes({ |