K
K
Konstantin2020-12-15 18:07:06
Angular
Konstantin, 2020-12-15 18:07:06

What is the correct way to throw an rxjs exception?

this.markAsReadClick
            .pipe(
                concatMap(() =>
                    this.documentsRepository.selectedDocumentsReestrIds$.pipe(
                        take(1),
                        tap((ids: number[]) => {
                            if (!ids.length) throw throwError('Error');
                        }),
                      
                        concatMap((ids: number[]) =>


I'm trying to throw an exception to prevent concatMap from executing:

if (!ids.length) throw throwError('Error');

If an error occurs, exit this.markAsReadClick. How to avoid it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question