Skip to content

Apollo throws error when testing GraphQLErrors in jasmine/karma #1690

Answered by Joaovtrc
Joaovtrc asked this question in Q&A
Discussion options

You must be logged in to vote

So....

public getThirdPartyCompanies(): void {
      console.log('getThirdPartyCompanies');
      this.courierService.getThirdPartyCourierList(this.cityId)
                         .pipe(takeUntil(this.subscriptionDestroyer))
                         .subscribe((req) => {
        this.thirdPartyCourierList = req.data.thirdPartyCourierCompanies;
        this.loadingThirdies = false;
      }
      ), err =>{
        this.errorHandlerService.handleError(err);
        this.loadingThirdies = false;
      };
    }

Here was the code I was using for the call. Notice that I was closing the observable before the error call.

All I had to do was:

 }, err =>{
            this.errorHandlerService.hand…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Joaovtrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant