Skip to content

Async client methods should not declare exceptions #96

Closed
@MT-Jacobs

Description

@MT-Jacobs

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions