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.

Load a report; missing ids reject and hit catch.

Important JavaScript

async function loadReport(id) {
  setLoading(true);
  try {
    const report = await fetchReport(id);
    show(report);
  } catch (error) {
    showError(error.message);
  } finally {
    setLoading(false);
  }
}