-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_transactionController.diff
More file actions
26 lines (25 loc) · 1.34 KB
/
patch_transactionController.diff
File metadata and controls
26 lines (25 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- backend/controllers/transactionController.js
+++ backend/controllers/transactionController.js
@@ -462,7 +462,7 @@
})
.on('end', () => {
// Performance: use async unlink to avoid blocking the event loop
- fs.promises.unlink(filePath).catch(err => console.error('Failed to delete temp file:', err));
+ fs.unlink(filePath, (err) => { if (err) console.error('Failed to delete temp file:', err) });
resolve({ results, errors, rowIndex });
})
.on('error', (error) => {
// Performance: use async unlink to avoid blocking the event loop
- fs.promises.unlink(filePath).catch(err => console.error('Failed to delete temp file:', err));
+ fs.unlink(filePath, (err) => { if (err) console.error('Failed to delete temp file:', err) });
reject(error);
});
});
@@ -564,7 +564,7 @@
} catch (error) {
if (req.file) {
// Performance: use async unlink to avoid blocking the event loop
- fs.promises.unlink(req.file.path).catch(err => console.error('Failed to delete temp file:', err));
+ fs.unlink(req.file.path, (err) => { if (err) console.error('Failed to delete temp file:', err) });
}
// Pass to global error handler