I have this observable
createMyRecord(): Observable<myRecord> {
return of(TEMPLATE_DB).pipe(
mergeMap((template) => doTask(template)),
mergeMap(() => EMPTY)
);
}
I call it with
await createMyRecord().toPromise();
.toPromise() is deprecated, so I would like to change the call with lastValueFrom():
await lastValueFrom(createMyRecord());
but I receive the following error:
EmptyError
no elements in sequence
UPDATE: for now, resolved with:
await lastValueFrom(createMyRecord()).catch((err) => {
if (err instanceof EmptyError) {
log.info(OK");
}
});
but is there a better solution?