Angular · Senior · Question 43 of 75
How do you centrally report uncaught errors in an Angular app?
- ✓Correct answer: Provide a custom
ErrorHandlerand send errors to a monitoring service - 2Wrap every component method in
try/catch - 3Use
window.onerroronly; Angular swallows all errors
Explanation
{ provide: ErrorHandler, useClass: SentryErrorHandler } receives errors from templates, lifecycle hooks and event handlers. HTTP errors are better handled in interceptors.