use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, thiserror::Error)]
#[serde(tag = "kind", rename_all = "kebab-case")]
pub enum SourceError {
#[error("configuration for this source is invalid: {message}")]
Config {
message: String,
},
#[error("authentication for this source failed: {message}")]
Auth {
message: String,
},
#[error("the source refused the request: {message}")]
Refused {
message: String,
},
#[error("the source rate-limited the request")]
RateLimited {
retry_after_seconds: Option<u64>,
},
#[error("the source could not be reached: {message}")]
Unavailable {
message: String,
},
#[error("the source returned data this interface cannot represent: {message}")]
Malformed {
message: String,
},
}