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

Async client methods should not declare exceptions #96

Closed
MT-Jacobs opened this issue Jan 7, 2022 · 1 comment
Closed

Async client methods should not declare exceptions #96

MT-Jacobs opened this issue Jan 7, 2022 · 1 comment
Labels
Category: Enhancement New feature or request v7.16.2
Milestone

Comments

@MT-Jacobs
Copy link

For my example, let's take a look at ElasticsearchAsyncClient#index:

	public <TDocument> CompletableFuture<IndexResponse> index(IndexRequest<TDocument> request)
			throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint<IndexRequest<?>, IndexResponse, ErrorResponse> endpoint = (JsonEndpoint<IndexRequest<?>, IndexResponse, ErrorResponse>) IndexRequest._ENDPOINT;

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

Is it true that this method can actually throw an IOException? I'd expect that the CompletableFuture might return a failure (essentially wrapping the exception), but it's not actually throwing said exception. Am I missing some other checked IOException further down in the call chain? In the above example, RestClientTransport#performRequestAsync doesn't throw an IOException.

@swallez swallez added v7.16.2 Category: Enhancement New feature or request labels Jan 10, 2022
@swallez swallez added this to the v7.17.0 milestone Jan 10, 2022
@swallez
Copy link
Member

swallez commented Jan 10, 2022

You're indeed right @MT-Jacobs, thanks for the catch. Neither IOException nor ElasticsearchException are actually thrown from async client methods. We'll remove them.

@swallez swallez changed the title IOExceptions on async client? Async client methods should not declare exceptions Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Enhancement New feature or request v7.16.2
Projects
None yet
Development

No branches or pull requests

2 participants