Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors from methods returning a Promise are not bubbling up when Promise is converted to Observable #3478

Open
chan-dev opened this issue Dec 14, 2023 · 2 comments

Comments

@chan-dev
Copy link

In order to achieve consistency, i want to convert methods returning Promises to Observable.
However, errors are ignored when trying to catch the error either from the method or from the caller of the method.

See the code below.

createList(newList: NewListDTO) {
    const collectionRef = collection(this.db, `lists`);

    const newListDoc = addDoc(collectionRef, {
      name: newList.name,
      uid: newList.uid,
      created_at: serverTimestamp(),
    });

    // return defer(async () => {
    //   return await newListDoc;
    // });

    return scheduled(newListDoc, asyncScheduler).pipe(
      // FIXME: error is not being caught from firstore addDoc
      catchError((err) => {
        return throwError(() => err);
      }),
    );
  }
@google-oss-bot
Copy link

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@Sapython
Copy link

Have your tried using of or from from rxjs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants