fix(core): recover corrupted models cache (#30947)

This commit is contained in:
Shoubhit Dash 2026-06-05 18:07:09 +05:30 committed by GitHub
commit 0ee7cfa1fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 69 additions and 6 deletions

View file

@ -84,7 +84,10 @@ export namespace FSUtil {
const readJson = Effect.fn("FileSystem.readJson")(function* (path: string) {
const text = yield* fs.readFileString(path)
return JSON.parse(text)
return yield* Effect.try({
try: () => JSON.parse(text),
catch: (cause) => new FileSystemError({ method: "readJson", cause }),
})
})
const writeJson = Effect.fn("FileSystem.writeJson")(function* (path: string, data: unknown, mode?: number) {