We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 755cdae commit f59800bCopy full SHA for f59800b
elasticsearch/src/http/response.rs
@@ -21,6 +21,22 @@ impl Response {
21
self.0.status()
22
}
23
24
+ /// Turn the response into an `Error` if Elasticsearch returned an error.
25
+ pub fn error_for_status_code(self) -> Result<Self, Error> {
26
+ match self.0.error_for_status_ref() {
27
+ Ok(_) => Ok(self),
28
+ Err(err) => Err(err.into()),
29
+ }
30
31
+
32
33
+ pub fn error_for_status_code_ref(&self) -> Result<&Self, Error> {
34
35
36
37
38
39
40
/// The response headers
41
pub fn headers(&self) -> &HeaderMap {
42
self.0.headers()
0 commit comments