Bird
0
0

Why is it important that the function passed to catchError returns an Observable?

hard🧠 Conceptual Q10 of 15
Angular - RxJS Operators
Why is it important that the function passed to catchError returns an Observable?
ABecause catchError only works with synchronous values.
BBecause catchError replaces the error stream with a new Observable to continue the flow.
CBecause catchError converts Observables to Promises internally.
DBecause catchError automatically unsubscribes if a non-Observable is returned.
Step-by-Step Solution
Solution:
  1. Step 1: Understand catchError's role in stream recovery

    It replaces the error stream with a new Observable to keep the stream alive.
  2. Step 2: Why Observable return is required

    Returning an Observable ensures the stream continues correctly; returning other types breaks the contract.
  3. Final Answer:

    Because catchError replaces the error stream with a new Observable to continue the flow. -> Option B
  4. Quick Check:

    catchError must return Observable to continue stream [OK]
Quick Trick: catchError returns Observable to replace error and continue stream [OK]
Common Mistakes:
MISTAKES
  • Thinking catchError converts to Promise
  • Assuming catchError works only synchronously
  • Believing catchError unsubscribes on non-Observable return

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes