Skip to content

Commit a4421c2

Browse files
Fix bug with reading binary file
Signed-off-by: Sanjula Ganepola <[email protected]>
1 parent 90a4e12 commit a4421c2

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/views/examples/index.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6075,17 +6075,24 @@ async function getSqlTextDocumentsFromDirectory(directory: Uri, depth = 1): Prom
60756075
const uri = Uri.joinPath(directory, name);
60766076

60776077
if (type === FileType.File) {
6078-
const textDocument = await workspace.openTextDocument(uri);
6079-
if (textDocument.languageId === 'sql') {
6080-
sqlTextDocuments.push(textDocument);
6078+
try {
6079+
const textDocument = await workspace.openTextDocument(uri);
6080+
if (textDocument.languageId === 'sql') {
6081+
sqlTextDocuments.push(textDocument);
6082+
}
6083+
} catch (error) {
6084+
// Ignore error reading file
6085+
console.log(error);
6086+
continue;
60816087
}
60826088
} else if (type === FileType.Directory && depth > 0) {
60836089
const subContents = await getSqlTextDocumentsFromDirectory(uri, depth - 1);
60846090
sqlTextDocuments.push(...subContents);
60856091
}
60866092
}
6087-
} catch {
6088-
// Ignore errors
6093+
} catch (error) {
6094+
// Ignore error reading directory
6095+
console.log(error);
60896096
}
60906097

60916098
return sqlTextDocuments;

0 commit comments

Comments
 (0)