Angular & Signals (283 Qs)•Part 2: HttpClient, RxJS Observables & Angular Elements (36 - 62)
What will happen if you do not supply handler for the observer?
Usually, an observer object can define any combination of next, error, and complete notification type handlers. If you don't supply a handler for a notification type, the observer just ignores notifications of that type.
Practical Code Example
typescript
// If no error handler is provided in the subscribe block,
// the unhandled error bubbles up to the global Zone.js / ErrorHandler:
observable$.subscribe({
next: (data) => console.log(data),
// Missing error handler: Error crashes to GlobalErrorHandler!
error: (err) => console.error('Caught error cleanly:', err) // Always supply error callback!
});