mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[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:
@@ -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 ?? '');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user