Description
The handleUpload function in next-ts/src/lib/common/helper-methods.ts (lines 49-84) currently swallows errors in its catch block, preventing callers from detecting upload failures. This causes the FileUpload component to show a "done" state even when uploads fail.
Location
- File:
next-ts/src/lib/common/helper-methods.ts
- Lines: 49-84
- Function:
handleUpload
Problem
The catch block on line 80 logs the error and shows a toast message but never re-throws, causing callers like FileUpload/index.tsx to treat failed uploads as successful.
Proposed Solution
Update the catch block to propagate the failure by either:
- Re-throwing the caught error (
throw error;)
- Returning
Upload.LIST_IGNORE on error
Keep the existing logging and toast notifications but ensure the error is not swallowed.
Example Fix
} catch (error) {
console.error(error);
message.error("Upload failed");
throw error; // Add this line
}
Context
Description
The
handleUploadfunction innext-ts/src/lib/common/helper-methods.ts(lines 49-84) currently swallows errors in its catch block, preventing callers from detecting upload failures. This causes the FileUpload component to show a "done" state even when uploads fail.Location
next-ts/src/lib/common/helper-methods.tshandleUploadProblem
The catch block on line 80 logs the error and shows a toast message but never re-throws, causing callers like
FileUpload/index.tsxto treat failed uploads as successful.Proposed Solution
Update the catch block to propagate the failure by either:
throw error;)Upload.LIST_IGNOREon errorKeep the existing logging and toast notifications but ensure the error is not swallowed.
Example Fix
Context