Complete the code to import the catchError operator from RxJS.
import { [1] } from 'rxjs/operators';
The catchError operator is imported from rxjs/operators to handle errors in observable streams.
Complete the code to use catchError inside the pipe to handle errors.
this.http.get('/api/data').pipe([1](error => { console.error(error); return of([]); }))
The catchError operator is used inside pipe to catch errors from the observable and handle them gracefully.
Fix the error in the catchError usage by completing the code.
this.http.get('/api/data').pipe(catchError([1] => { console.log('Error occurred'); return of([]); }))
The parameter inside catchError callback represents the error object, so naming it error is clear and conventional.
Fill both blanks to create a catchError that logs the error and returns a fallback observable.
this.http.get('/api/items').pipe([1](err => { console.error('Error:', [2]); return of([]); }))
Use catchError to handle errors, and inside the callback, log the err parameter to see what went wrong.
Fill all three blanks to handle errors by logging, showing a message, and returning a fallback observable.
this.http.get('/api/users').pipe([1](error => { console.error(error); this.message = [2]; return [3]([]); }))
Use catchError to catch errors, set a user-friendly message, and return an observable with an empty array using of.