Error handlingedit

The client exposes a variety of error objects, that you can use to enhance your error handling.
You can find all the error objects inside the errors key in the client.

const { errors } = require('@elastic/elasticsearch')
console.log(errors)

Following you can find the errors exported by the client.

ElasticsearchClientErrors

Every error inherits from this class, it is the basic error generated by the client.

TimeoutError

Generated when a request exceeds the requestTimeout option.

ConnectionError

Generated when an error occurs during the reequest, it can be a connection error or a malformed stream of data.

NoLivingConnectionsError

Generated in case of all connections present in the connection pool are dead.

SerializationError

Generated if the serialization fails.

DeserializationError

Generated if the deserialization fails.

ConfigurationError

Generated if there is a malformed configuration or parameter.

ResponseError

Generated when in case of a 4xx or 5xx response.