🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
File deletion error handling
Edward Cuie1f4bfc40380
diff --git a/server/src/services/import/utils.ts b/server/src/services/import/utils.tsindex beb0db96b..32efce365 100644--- a/server/src/services/import/utils.ts+++ b/server/src/services/import/utils.ts@@ -2,11 +2,16 @@ import { r2Storage } from "../storage/r2StorageService.js";import fs from "fs";export const deleteImportFile = async (storageLocation: string, isR2Storage: boolean) => {- if (isR2Storage) {- await r2Storage.deleteImportFile(storageLocation);- console.log(`Deleted R2 import file: ${storageLocation}`);- } else {- await fs.promises.unlink(storageLocation);- console.log(`Deleted local import file: ${storageLocation}`);+ try {+ if (isR2Storage) {+ await r2Storage.deleteImportFile(storageLocation);+ console.log(`Deleted R2 import file: ${storageLocation}`);+ } else {+ await fs.promises.unlink(storageLocation);+ console.log(`Deleted local import file: ${storageLocation}`);+ }+ } catch (error) {+ console.error(`Failed to delete import file ${storageLocation}:`, error);+ throw error;}}