Skip to content

BearerToken error handling fail #117

Description

@hporchet

When the application of the metadata is in error, the fail method crash : apply() or fail() already called and hide the exception of the apply method.

public class BearerToken extends CallCredentials {
    ...

    @Override
    public void applyRequestMetadata(RequestInfo requestInfo, Executor executor, MetadataApplier applier) {
        executor.execute(() -> {
            try {
                Metadata headers = new Metadata();
                headers.put(META_DATA_KEY, header);
                applier.apply(headers); // crash
            } catch (Throwable e) {
                applier.fail(Status.UNAUTHENTICATED.withCause(e)); // can't be called after crashed, error : apply() or fail() already called
            }
        });
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions