Using RxJs EMPTY in switch statement

I have the encountered a code in a project that I started to maintain. There is a switch block where is some lines return EMPTY in each case as shown below:

update(data) {
        // ...
        catchError((err:any) => {
          switch (err.status) {
            case 400:
              // display message
              return EMPTY;
            case 403
              // display message
              return EMPTY;
            case 500
              // display message
              return EMPTY;
              return EMPTY;
          // return EMPTY; //can I use only this EMPTY instead of above ones?

I am wondering does it make any sense using it as shown above or at the end of switch block? I am new in RxJs and not sure if return EMPTY in each case has special meaning (there is also no break maybe due to return).

96 thoughts on “Using RxJs EMPTY in switch statement”

  1. 977125 599928thank you dearly author , I found oneself this internet site quite helpful and its full of exceptional healthy selective data ! , I as well thank you for the fantastic food plan post. 357192


Leave a Comment