async try / catch / finally
Handle await failures with familiar try / catch / finally (Phase 10).
A rejected promise that you await throws into the surrounding
try block. Use catch for the error message and
finally for cleanup (same idea as .finally).
Remember: this still only pauses the async function — the UI stays responsive.
Idle
Results appear here.
Important JavaScript
async function loadReport(id) {
setLoading(true);
try {
const report = await fetchReport(id);
show(report);
} catch (error) {
showError(error.message);
} finally {
setLoading(false);
}
}