Refactor unlinkWithRetry to include error handling

pull/2656/head
Prisca Amajuoyi 7 months ago committed by Mikael Finstad
parent fd5cffaf1a
commit 01fe3bb526

@ -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'

Loading…
Cancel
Save