10000 Error logging in hold streams · Issue #661 · rx-angular/rx-angular · GitHub
[go: up one dir, main page]

Skip to content

Error logging in hold streams #661

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

Open
d-stolyar opened this issue Apr 16, 2021 · 2 comments · May be fixed by #678
Open

Error logging in hold streams #661

d-stolyar opened this issue Apr 16, 2021 · 2 comments · May be fixed by #678

Comments

@d-stolyar
Copy link
d-stolyar commented Apr 16, 2021

Description

Errors in hold streams are not logged

Steps to Reproduce the Issue

Check stackblitz example

this.hold(
  of(null).pipe(switchMap(() => throwError("error"))),
  value => {
    console.log(value);
  }
);

Result in console:

Expected result in console:
error

Solution

Add console.error in hold definition

hold<S>(
  obsOrObsWithSideEffect: Observable<S>,
  sideEffectFn?: (arg: S) => void
): void {
  const sideEffect = obsOrObsWithSideEffect.pipe(catchError(e => {
    console.error(e)
    return EMPTY
  }))
  if (typeof sideEffectFn === 'function') {
    this.effectObservable.nextEffectObservable(
      sideEffect.pipe(tap(sideEffectFn))
    );
    return;
  }
  this.effectObservable.nextEffectObservable(sideEffect);
}
@BioPhoton
Copy link
Member

Thx for the issue!
Get back with updates.

@d-stolyar d-stolyar linked a pull request Apr 22, 2021 that will close this issue
@BioPhoton
Copy link
7175 Member
BioPhoton commented May 5, 2021

Hi!

In the PR for RxEffects we implemented angulars error handler. Would be col if we could do the same here.
https://github.com/rx-angular/rx-angular/pull/569/files#diff-9afb99d5c66b09318924448921fd9e1f7eefe3b2d5244af8f125266f57378c93R75

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

Successfully merging a pull request may close this issue.

2 participants
0