From 2e10eb04b65ae1b88e41e0946f770e956e9a7072 Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Mon, 7 Mar 2022 13:08:54 +0100 Subject: [PATCH] Correct media upload error + add file name (#11949) Co-authored-by: Bram Kragten --- src/data/image.ts | 2 +- src/data/media_source.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/image.ts b/src/data/image.ts index 497f2ffa3a..94198de6dc 100644 --- a/src/data/image.ts +++ b/src/data/image.ts @@ -29,7 +29,7 @@ export const createImage = async ( body: fd, }); if (resp.status === 413) { - throw new Error("Uploaded image is too large"); + throw new Error(`Uploaded image is too large (${file.name})`); } else if (resp.status !== 200) { throw new Error("Unknown error"); } diff --git a/src/data/media_source.ts b/src/data/media_source.ts index 61494ee3f8..a6e93d83cf 100644 --- a/src/data/media_source.ts +++ b/src/data/media_source.ts @@ -43,7 +43,7 @@ export const uploadLocalMedia = async ( } ); if (resp.status === 413) { - throw new Error("Uploaded image is too large"); + throw new Error(`Uploaded file is too large (${file.name})`); } else if (resp.status !== 200) { throw new Error("Unknown error"); }