Module elastic::error [] [src]

Client-side error types.

The main Error type combines the various kinds of errors that can occur when interacting with Elasticsearch.

Examples

Any method defined in elastic that could fail will return a Result<T, Error> that can be matched on. The below example sends a request and then checks the response for an Error::Api:

// Send a request.
// The returned error may be a REST API error from Elasticsearch or an internal error
let response = client.search::<Value>().send();

match response {
    Ok(response) => {
        // do something with the response
    },
    Err(Error::Api(e)) => {
        // handle a REST API error
    },
    Err(e) => {
        // handle a client error
    }
}

Structs

ClientError

An error building a client, sending a request or receiving a response.

Enums

ApiError

A REST API error response.

Error

An error encountered while interacting with Elasticsearch.

Type Definitions

Result

An alias for a result.