Skip to content

Commit 52924f4

Browse files
committed
Document syntax that is unsupported inside try/catch
1 parent 2b9ac13 commit 52924f4

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎src/content/learn/react-compiler/debugging.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,14 @@ function WeatherReport({report}) {
5353
// ✅ Good: computed outside of try/catch
5454
const description = report.temperature > 30 ? "Warm" : "Mild";
5555

56+
let summary = null;
5657
try {
57-
return <div>{description}: {report.summary}</div>;
58+
summary = parseSummary(report.data);
5859
} catch (error) {
59-
return <div>Report unavailable</div>;
60+
summary = "Report unavailable";
6061
}
62+
63+
return <div>{description}: {summary}</div>;
6164
}
6265
```
6366

0 commit comments

Comments
 (0)