Skip to content

The swiss army knife of lossless video/audio editing

Refactor unlinkWithRetry to include error handling

Prisca Amajuoyi01fe3bb5267a
diff --git a/src/renderer/src/util.ts b/src/renderer/src/util.ts
index 766d556a..a7df3066 100644
--- a/src/renderer/src/util.ts
+++ b/src/renderer/src/util.ts
@@ -128,7 +128,7 @@ export async function fsOperationWithRetry<T>(operation: () => Promise<T>, { sig
// mimic fs.rm `maxRetries` https://nodejs.org/api/fs.html#fspromisesrmpath-options
shouldRetry: (err) => err instanceof Error && 'code' in err && typeof err.code === 'string' && ['EBUSY', 'EMFILE', 'ENFILE', 'EPERM'].includes(err.code),
...opts,
- });
+ } as Options);
}
// example error: index-18074aaf.js:166 Failed to delete C:\Users\USERNAME\Desktop\RC\New folder\2023-12-27 21-45-22 (GMT p5)-merged-1703933052361-00.01.04.915-00.01.07.424-seg1.mp4 Error: EPERM: operation not permitted, unlink 'C:\Users\USERNAME\Desktop\RC\New folder\2023-12-27 21-45-22 (GMT p5)-merged-1703933052361-00.01.04.915-00.01.07.424-seg1.mp4'