Error Handling & Resilience

Trigger real errors inside this sandbox. Watch which handler catches each one — and which slips past try/catch.

1 — Error scenarios

Each button runs code in the demo sandbox. Global listeners on this iframe's window log uncaught errors here — they do not propagate to the parent page.

What happens
Select a scenario and run it.
Local handler
Global capture

2 — Graceful retry

Simulated flaky API: ~60% failure rate. Retries with exponential backoff until success or max attempts — errors are caught, never leaked.

idle attempts: 0

Captured errors

Listeners: window.addEventListener('error') + 'unhandledrejection'. Demo errors call preventDefault() so they stay in this iframe.

No errors captured yet — run a scenario.

Scoped via __DEMO_ERROR__ marker on thrown values and event.preventDefault() on global handlers. Parent frame is unaffected.