indexnow_api/error/
mod.rs1use std::fmt::{Debug, Display, Formatter};
2
3#[derive(Clone, PartialEq, Eq)]
8pub enum IndexNowError {
9 Connection(String),
12 Status {
14 code: u16,
16 body: String,
18 },
19}
20
21impl Display for IndexNowError {
22 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
23 match self {
24 IndexNowError::Connection(e) => f.write_str(e),
25 IndexNowError::Status { code, body } => {
26 write!(f, "IndexNow API returned status {}: {}", code, body)
27 }
28 }
29 }
30}
31
32impl Debug for IndexNowError {
33 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
34 Display::fmt(self, f)
35 }
36}
37
38impl std::error::Error for IndexNowError {}
39
40#[deprecated(since = "1.1.0", note = "renamed to `IndexNowError`")]
42pub type GoogleApiError = IndexNowError;