pub enum WebmasterApiError {
HttpError(Error),
MiddlewareHttpError(Error),
ParseError(Error),
ApiError {
status: Option<u16>,
error_code: Option<BingErrorCode>,
error_code_raw: i32,
message: String,
},
HttpStatusError {
status: u16,
message: String,
response_body: Option<String>,
},
InvalidResponse(String),
AuthenticationError,
Other(Error),
}Expand description
Errors that can occur when interacting with the Bing Webmaster API
Variants§
HttpError(Error)
HTTP request failed
MiddlewareHttpError(Error)
Middleware request failed
ParseError(Error)
Failed to parse response
ApiError
API returned a structured error
Fields
error_code: Option<BingErrorCode>Error code enum (if recognized)
HttpStatusError
HTTP status error without structured API response
Fields
InvalidResponse(String)
Invalid API response format
AuthenticationError
Authentication failed
Other(Error)
Other errors (for anyhow integration)
Implementations§
Source§impl WebmasterApiError
impl WebmasterApiError
Sourcepub fn api_error(
error_code_raw: i32,
message: String,
status: Option<u16>,
) -> Self
pub fn api_error( error_code_raw: i32, message: String, status: Option<u16>, ) -> Self
Create an API error from error code and message
Sourcepub fn http_status(status: u16, message: impl Into<String>) -> Self
pub fn http_status(status: u16, message: impl Into<String>) -> Self
Create an HTTP status error
Sourcepub fn http_status_with_body(
status: u16,
message: impl Into<String>,
response_body: impl Into<String>,
) -> Self
pub fn http_status_with_body( status: u16, message: impl Into<String>, response_body: impl Into<String>, ) -> Self
Create an HTTP status error with response body
Sourcepub fn invalid_response(message: impl Into<String>) -> Self
pub fn invalid_response(message: impl Into<String>) -> Self
Create an invalid response error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is retryable
Sourcepub fn is_authentication_error(&self) -> bool
pub fn is_authentication_error(&self) -> bool
Check if this error is related to authentication
Sourcepub fn is_rate_limit_error(&self) -> bool
pub fn is_rate_limit_error(&self) -> bool
Check if this error is related to rate limiting
Sourcepub fn status_code(&self) -> Option<u16>
pub fn status_code(&self) -> Option<u16>
Get the HTTP status code if available
Sourcepub fn response_body(&self) -> Option<&str>
pub fn response_body(&self) -> Option<&str>
Get the response body if available
Sourcepub fn error_code(&self) -> Option<Result<BingErrorCode, i32>>
pub fn error_code(&self) -> Option<Result<BingErrorCode, i32>>
Get the error code if this is an API error
Returns the BingErrorCode if recognized, otherwise returns the raw error code value
Sourcepub fn api_message(&self) -> Option<&str>
pub fn api_message(&self) -> Option<&str>
Get the error message if this is an API error
Trait Implementations§
Source§impl Debug for WebmasterApiError
impl Debug for WebmasterApiError
Source§impl Display for WebmasterApiError
impl Display for WebmasterApiError
Source§impl Error for WebmasterApiError
impl Error for WebmasterApiError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Error> for WebmasterApiError
impl From<Error> for WebmasterApiError
Source§impl From<Error> for WebmasterApiError
impl From<Error> for WebmasterApiError
Source§impl From<Error> for WebmasterApiError
impl From<Error> for WebmasterApiError
Auto Trait Implementations§
impl Freeze for WebmasterApiError
impl !RefUnwindSafe for WebmasterApiError
impl Send for WebmasterApiError
impl Sync for WebmasterApiError
impl Unpin for WebmasterApiError
impl !UnwindSafe for WebmasterApiError
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.