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 ErrorKind::Api:

// Send a request.
// This will return a Result<ResponseBuilder, Error>
let res = client.request(req).send();

match res {
    Ok(response) => {
        // do something with the response
    },
    Err(e) => {
        match *e.kind() {
            ErrorKind::Api(ref e) => {
                // handle a REST API error
            },
            ref e => {
                // handle a HTTP or JSON error
            }
        }
    }
}

Structs

Error

The Error type.

Enums

ApiError

A REST API error response.

ErrorKind

The kind of an error.

ParseResponseError

An error parsing a response stream.

Traits

ResultExt

Additional methods for Result, for easy interaction with this crate.

Type Definitions

Result

Convenient wrapper around std::Result.