pub struct MsgraphApiError {
pub status: u16,
pub code: String,
pub message: String,
pub method: String,
pub retry_after: Option<Duration>,
pub www_authenticate: Option<String>,
pub request_id: Option<String>,
pub keep_alive: bool,
}Expand description
A non-2xx answer of the Graph API: its error envelope, and what its headers tell a caller to do next.
Fields§
§status: u16The HTTP status of the response.
code: StringThe error code of the Graph error envelope.
message: StringThe human-readable message of the Graph error envelope.
method: StringThe method of the refused request, uppercase.
retry_after: Option<Duration>How long the server asked to wait before a retry: the
Retry-After header in its seconds form, a date reading as none.
www_authenticate: Option<String>The WWW-Authenticate header, which carries the claims challenge
of a 401 the next token request has to answer.
request_id: Option<String>The id Graph gave the request, from the request-id header, else
from the envelope.
keep_alive: boolWhether the server allows reusing the TCP/TLS connection.
Implementations§
Source§impl MsgraphApiError
impl MsgraphApiError
Sourcepub fn parse<'a>(
status: u16,
headers: impl IntoIterator<Item = (&'a str, &'a str)>,
body: &[u8],
) -> Self
pub fn parse<'a>( status: u16, headers: impl IntoIterator<Item = (&'a str, &'a str)>, body: &[u8], ) -> Self
Reads a non-2xx answer: the error envelope of its body, falling
back as parse_api_error does, and its headers.
Neither tells the method of the request nor the connection reuse: the exchange fills those in.
Sourcepub fn is_throttled(&self) -> bool
pub fn is_throttled(&self) -> bool
Whether Graph throttled the request (429): it was not taken, so
sending it again after retry_after is safe
whatever its method.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether the request can be sent again as it is: a throttled one, or a transient 5xx on a method a repeat cannot double.
A POST or a PATCH answered by a 5xx may have been applied, so it is not retryable here: a mail could be sent twice.
Trait Implementations§
Source§impl Clone for MsgraphApiError
impl Clone for MsgraphApiError
Source§impl Debug for MsgraphApiError
impl Debug for MsgraphApiError
Source§impl Default for MsgraphApiError
impl Default for MsgraphApiError
Source§impl Display for MsgraphApiError
impl Display for MsgraphApiError
impl Eq for MsgraphApiError
Source§impl Error for MsgraphApiError
impl Error for MsgraphApiError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()