Skip to content

Commit 17e41eb

Browse files
committed
fix: handle open file in compile disgnostic provider
1 parent c674c69 commit 17e41eb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/compile/compileManager.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,17 @@ class CompileDiagnosticProvider {
6969
const vfs = await this.vfsm.prefetch(uri);
7070
const logPath = `${OUTPUT_FOLDER_NAME}/output.log`;
7171
const _uri = vfs.pathToUri(logPath);
72-
let content ='';
73-
content = new TextDecoder().decode(await vfs.openFile(_uri));
72+
let content = '';
73+
try {
74+
const fileData = await vfs.openFile(_uri);
75+
content = new TextDecoder().decode(fileData);
76+
} catch (error) {
77+
if (error instanceof vscode.FileSystemError && error.code === 'FileNotFound') {
78+
return false;
79+
}
80+
console.error('Error reading log file:', error);
81+
throw error; // Re-throw unexpected errors
82+
}
7483
const logs = new LatexParser(content).parse();
7584
if (logs === undefined) {
7685
return content === ''? true :false;

0 commit comments

Comments
 (0)