[forgive] Don't crash if we couldn't compile

Compiler shouldn't crash Forgive if it can't compile (eg parse error due to being mid-typing).

Co-authored-by: Jordan Brown <jmbrown@meta.com>
This commit is contained in:
Lauren Tan
2025-04-23 16:27:30 -04:00
parent 8f91c97d1c
commit 4c4d718bd1
@@ -134,11 +134,17 @@ documents.onDidChangeContent(async event => {
resetState();
if (SUPPORTED_LANGUAGE_IDS.has(event.document.languageId)) {
const text = event.document.getText();
await compile({
text,
file: event.document.uri,
options: compilerOptions,
});
try {
await compile({
text,
file: event.document.uri,
options: compilerOptions,
});
} catch (err) {
if (err instanceof Error) {
connection.console.error(err.stack ?? '');
}
}
}
});