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.
These include:
Api
: an error directly from an Elasticsearch exception, likeindex_not_found
. This is the probably the variant you'll be interested in handling.Json
: a general error serialising or deserialising json.Http
: a general error in the http transport.
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 |
Type Definitions
Result |
Convenient wrapper around |