Skip to content

Commit cc7fe60

Browse files
🐛 Prevent activation failure when workspace files are unreadable (#114)
1 parent 5ebab44 commit cc7fe60

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/appDiscovery.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ async function findAllFastAPIFiles(
6262
fileName === "conftest.py"
6363
)
6464
continue
65-
const content = await vscode.workspace.fs.readFile(uri)
65+
let content: Uint8Array
66+
try {
67+
content = await vscode.workspace.fs.readFile(uri)
68+
} catch {
69+
log(`Skipping unreadable file: ${uri.toString()}`)
70+
continue
71+
}
6672
if (new TextDecoder().decode(content).includes("FastAPI(")) {
6773
results.push(uri.toString())
6874
}

0 commit comments

Comments
 (0)