use serde_json::Value;
use thiserror::Error;
pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, Error)]
pub enum Error {
#[error("invalid base URL: {0}")]
InvalidUrl(#[from] url::ParseError),
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("Zammad API error ({status}): {message}")]
Api {
status: u16,
message: String,
},
#[error("resource not found")]
NotFound,
#[error(
"write verification failed: field `{field}` was not persisted (got {actual:?}); \
ensure the custom attribute exists and any pending migrations have been executed"
)]
WriteVerificationFailed {
field: String,
actual: Option<Value>,
},
#[error("decode error: {0}")]
Decode(#[from] serde_json::Error),
#[error("invalid configuration: {0}")]
Config(String),
}