Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Revert "omitlog" - there is already an if exists check

Manav Rathic2efd198a69f
diff --git a/desktop/src/main/services/ffmpeg.ts b/desktop/src/main/services/ffmpeg.ts
index aab43592b3..3b8e1d99f6 100644
--- a/desktop/src/main/services/ffmpeg.ts
+++ b/desktop/src/main/services/ffmpeg.ts
@@ -52,8 +52,6 @@ export const ffmpegExec = async (
writeToTemporaryFile: writeToTemporaryInputFile,
} = await makeFileForDataOrPathOrZipItem(dataOrPathOrZipItem);
- let success = false;
-
const outputFilePath = await makeTempFilePath(outputFileExtension);
try {
await writeToTemporaryInputFile();
@@ -65,16 +63,12 @@ export const ffmpegExec = async (
);
await execAsync(cmd);
- // execAsync will throw on non-zero exitCode.
- success = true;
return await fs.readFile(outputFilePath);
} finally {
if (isInputFileTemporary)
await deleteTempFileIgnoringErrors(inputFilePath);
- await deleteTempFileIgnoringErrors(outputFilePath, {
- omitLog: !success,
- });
+ await deleteTempFileIgnoringErrors(outputFilePath);
}
};
diff --git a/desktop/src/main/utils/temp.ts b/desktop/src/main/utils/temp.ts
index b3a00e89ea..85bfeae33e 100644
--- a/desktop/src/main/utils/temp.ts
+++ b/desktop/src/main/utils/temp.ts
@@ -67,20 +67,12 @@ export const deleteTempFile = async (tempFilePath: string) => {
* A variant of {@link deleteTempFile} that suppresses any errors, making it
* safe to call them in a sequence without needing to handle the scenario where
* one of them failing causes the rest to be skipped.
- *
- * @param opts - {@link omitLog} If set, an error message will not be logged if
- * the file cannot be deleted. This is convenient when we're trying to delete a
- * file which might not even exist, and so the error is expected.
*/
-export const deleteTempFileIgnoringErrors = async (
- tempFilePath: string,
- opts?: { omitLog?: boolean },
-) => {
+export const deleteTempFileIgnoringErrors = async (tempFilePath: string) => {
try {
await deleteTempFile(tempFilePath);
} catch (e) {
- if (!opts?.omitLog)
- log.error(`Failed to delete temporary file ${tempFilePath}`, e);
+ log.error(`Could not delete temporary file at path ${tempFilePath}`, e);
}
};