pub struct Reply {
pub status: u16,
pub body: Vec<u8>,
pub error_type: Option<String>,
}Expand description
What the control plane answered: a status, a raw body, and the error type the service named, if it named one.
Raw bytes rather than a deserialized value because the error path has to read a body
the success types cannot hold, and because TRAP-6’s null message field is only
visible to something that did not already require a String there.
Fields§
§status: u16§body: Vec<u8>§error_type: Option<String>The x-amzn-ErrorType header’s error name, cut down by error_type_name, or
None when the response carried no such header. classify_failure reads it
before the status, because the service has sent a throttle as HTTP 400.
Implementations§
Source§impl Reply
impl Reply
Sourcepub fn json<T: DeserializeOwned>(&self, operation: &str) -> Result<T, Error>
pub fn json<T: DeserializeOwned>(&self, operation: &str) -> Result<T, Error>
Deserializes the body as T, or reports the failure with the body attached.
The body goes in the message because a rest-json parse failure with the text withheld is unactionable: the reader cannot tell a renamed member from a truncated response. Truncated to 512 bytes, since a list response can be large and the first 512 characters always contain the member that failed.