Are we able to try / catch an image upload handler?
Even if I wrap it in try catch, and catch the error, it's not stopping
const uploadHandler = unstable_createMemoryUploadHandler({
maxPartSize: 5_000_000,
});
let formData: FormData;
try {
formData = await unstable_parseMultipartFormData(request, uploadHandler);
} catch (e) {
console.error(`Failed to parse form data: ${e}`); // <-- this runs
// but an error is still thrown and we end up in our error boundary
return { imageUploadError: "File size exceeds limit" };
}
It will attempt to upload, and only fail when it hits the exceeded number, and the error is still throwing. Any ideas?