Description
Error handling is a core aspect of Frontend. There are a few ways in which they can be handled.
Reach for when
One widget fails on a multi-widget page :: Error boundary per widget. Failed widget shows "Couldn't load — retry." Others unaffected.
API returns error during infinite scroll :: Show last successfully loaded items. "Couldn't load more — retry" at the bottom.
Optimistic action fails :: rollback from snapshot + error toast
Real-time connection drops (SSE/WS) :: Silent fallback to polling. Only show indicator for primary features (chat), not background features (notifications).
Initial page load fails :: Full error state with retry button. If cached data exists, show it with "Offline" banner.