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

After upgrading angular from v13 to v15 I have a problem with catching errors in tapResult's error callback. #49

Open
alexeek opened this issue Mar 13, 2023 · 1 comment

Comments

@alexeek
Copy link

alexeek commented Mar 13, 2023

Which @ngneat/effects-* package(s) are the source of the bug?

effects-ng

Is this a regression?

Yes

Description

I have angular upgraded from 13 to 15. I am using effects-ng for http requests.
In case I have http error I can't get the error response in tapResult's error callback and can't intercept this error inside angular error interceptor.
Is there a problem with compatibility or something else?
For example I'm getting error 404 from server but code in tapResult's error callback doesn't invokes. And the most important problem is that I can't intercept this error.
In previous version of angular (v13) everything worked fine.

  fetch$ = createEffect(actions =>
    actions.pipe(
      ofType(fetchModel),
      switchMap(({ payload }) => {
        return this.modelApiService.fetch(payload).pipe(
          tapResult(
            response => {
              this.modelRepo.addModelAndSetActive(<EntityTypeObjects.ModelEntityObject>response.data);
            },
            (error: string) => {
              //!!!can't get here!!!
              throwError(() => new Error(error));
            }
          )
        );
      })
    )
  );

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

I can't get into error callback in tapResult

Please provide the environment you discovered this bug in

Dependencies


    "@angular/animations": "^15.1.5",
    "@angular/cdk": "^15.1.5",
    "@angular/common": "^15.1.5",
    "@angular/compiler": "^15.1.5",
    "@angular/core": "^15.1.5",
    "@angular/forms": "^15.1.5",
    "@angular/platform-browser": "^15.1.5",
    "@angular/platform-browser-dynamic": "^15.1.5",
    "@angular/router": "^15.1.5",
    "rxjs": "~7.5.0",
...
    "@ngneat/effects": "^1.1.1",
    "@ngneat/effects-ng": "3.1.0",
    "@ngneat/elf": "^2.1.0",
    "@ngneat/elf-cli-ng": "^1.0.0",
    "@ngneat/elf-entities": "^4.3.1",
    "@ngneat/elf-pagination": "^1.0.1",
    "@ngneat/elf-persist-state": "^1.1.2",


### Anything else?

_No response_

### Do you want to create a pull request?

No
@EricPoul
Copy link
Collaborator

EricPoul commented Mar 15, 2023

I've just played with it and it seems fine. Could you provide more info?
https://stackblitz.com/edit/angular-ch2mt3?file=src%2Fmain.ts

tapResult hasn't been changed in the last merged features.

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

2 participants