mirror of
https://github.com/whyour/qinglong.git
synced 2026-02-12 14:05:38 +08:00
Add error handling for file handle close operation
- Wrap fileHandle.close() in try-catch to prevent masking original errors - Log close errors without throwing to preserve error context Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
parent
e1ce0f3fa9
commit
d30eb2008c
|
|
@ -31,7 +31,12 @@ export async function writeFileWithLock(
|
|||
throw new Error(`Failed to create file ${filePath}: ${errorMessage}`);
|
||||
} finally {
|
||||
if (fileHandle) {
|
||||
await fileHandle.close();
|
||||
try {
|
||||
await fileHandle.close();
|
||||
} catch (closeError) {
|
||||
// Log close error but don't throw to avoid masking the original error
|
||||
Logger.error(`Failed to close file handle for ${filePath}:`, closeError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user