mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 00:20:04 +01:00
[forgive] Don't crash if we couldn't compile (#33001)
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> --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33001). * #33002 * __->__ #33001 * #33000 --------- Co-authored-by: Jordan Brown <jmbrown@meta.com>
This commit is contained in:
parent
f765082996
commit
b75af04670
|
|
@ -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 ?? '');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user