fix(frontend): show specific error messages for store image upload failures (#12361)

### Changes
- Surface backend error details (file size limit, invalid file type,
virus detected, etc.) in the upload failed toast instead of showing a
generic "Upload Failed" message
- The backend already returns specific error messages (e.g., "File too
large. Maximum size is 50MB") but the frontend was discarding them with
a catch-all handler
  
<img width="1222" height="411" alt="Screenshot 2026-03-11 at 9 13 30 AM"
src="https://github.com/user-attachments/assets/34ab3d90-fffa-4788-917a-fe2a7f4144b9"
/>

  ## Test plan
- [x] Upload an image larger than 50MB to a store submission → should
see "File too large. Maximum size is 50MB"
- [x] Upload an unsupported file type → should see file type error
message
  - [x] Upload a valid image → should still work normally

  Resolves SECRT-2093
This commit is contained in:
Abhimanyu Yadav
2026-03-11 15:37:37 +05:30
committed by GitHub
parent 0633475915
commit 0e0bfaac29

View File

@@ -110,10 +110,12 @@ export function useThumbnailImages({
if (!selectedImage) {
setSelectedImage(imageUrl);
}
} catch (_error) {
} catch (error) {
const detail =
error instanceof Error ? error.message : "Please try again.";
toast({
title: "Upload failed",
description: "Failed to upload image. Please try again.",
description: detail,
variant: "destructive",
});
}