Skip to content

[Question]: forward(...) in onGraphQLError(...) callback does not trigger it again for the same error? #502

@RCSandberg

Description

@RCSandberg

Background:

I've setup a link chain as follows:
final link = errorLink.concat(authLink).concat(httpLink);

I've also setup an ErrorLink with the callback onGraphQLError: (request, forward, response) async* { ... }
In that callback I'm detecting an error which is handled by getting a new access token using a refresh token. I do that there in a method.

Then I yield* forward(request);

This works like a charm in the happy path example.

My understanding is that this works fine because forward() sends it to authLink which appends the new access token via callback getToken() and all is well.

Question:
Perhaps it's trivial... but I need to ask :)

If I deliberatley do yield* forward(request); WITHOUT refreshing the new token, I thought I would end up in an infinite loop where the same error occurs and I end up in callback onGraphQLError() again.

But it seems like I don't... Is that correct behavior? I mean, is there a guard somehow for that?

Kind regards,
Robert

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions