mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-29 02:39:13 +00:00
fix: handle unreadable session files gracefully
readFile in parseSessionFile had no error handling. If a .jsonl file is missing, has bad permissions, or gets deleted between readdir and readFile, the whole process crashes with ENOENT. Now returns null and skips the file. Fixes #9
This commit is contained in:
parent
c7c6a0d2ec
commit
3964478e61
1 changed files with 6 additions and 1 deletions
|
|
@ -281,7 +281,12 @@ async function parseSessionFile(
|
|||
seenMsgIds: Set<string>,
|
||||
dateRange?: DateRange,
|
||||
): Promise<SessionSummary | null> {
|
||||
const content = await readFile(filePath, 'utf-8')
|
||||
let content: string
|
||||
try {
|
||||
content = await readFile(filePath, 'utf-8')
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
const lines = content.split('\n').filter(l => l.trim())
|
||||
const entries: JournalEntry[] = []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue