Production Angular apps separate render errors, HTTP failures, and user action mistakes. Users need visible recovery—retry buttons and role="alert" messages—not silent console.error only.
Async and HttpClient
Wrap awaits and subscriptions with error mapping into signals: loading, data, error. Show retry when error is set.
Global handlers
CLI apps can register provideBrowserGlobalErrorListeners() or custom error handlers for uncaught exceptions—complement local try/catch in components.
Important interview questions and answers
- Q: Does the template catch promise rejections?
A: No—you handle them in TypeScript and bind error state to the template. - Q: HTTP 500 response—what do users see?
A: A friendly message and optional retry—not a blank screen.
Self-check
- What appears in the preview when you click Simulate error?
- Where should operators read detailed stack traces?
Challenge
Surface an error
- Click Simulate error.
- Confirm the red alert text and terminal log.
Done when: preview shows role="alert" message and terminal logs Caught: Load failed.
Tip: Surface role="alert" messages for async failures—users cannot read the browser console.
Interview prep
- How handle failed HTTP calls?
Catch in subscribe/pipe, store an error signal, show retry UI—never fail silently in production.