Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix(media): fail the upload step when the backend returns an error

Gilad Resisi22f266aa24ca
diff --git a/libraries/react-shared-libraries/src/helpers/uppy.upload.ts b/libraries/react-shared-libraries/src/helpers/uppy.upload.ts
index acece4e7d..07dd08789 100644
--- a/libraries/react-shared-libraries/src/helpers/uppy.upload.ts
+++ b/libraries/react-shared-libraries/src/helpers/uppy.upload.ts
@@ -119,6 +119,11 @@ const fetchUploadApiEndpoint = async (
'Content-Type': 'application/json',
},
});
+ // customFetch does not throw on HTTP errors, and Uppy treats whatever this
+ // returns as a successful step
+ if (!res.ok) {
+ throw new Error(await res.text().catch(() => ''));
+ }
return res.json();
};