use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum EmbedError {
#[error("network error: {0}")]
Network(String),
#[error("provider authentication failed: {0}")]
Auth(String),
#[error("provider rate-limited the request (HTTP 429): {0}")]
RateLimited(String),
#[error("provider rejected the request (HTTP {status}): {body}")]
BadRequest {
status: u16,
body: String,
},
#[error("provider returned 5xx (HTTP {status}): {body}")]
Server {
status: u16,
body: String,
},
#[error("failed to decode provider response: {0}")]
Decode(String),
#[error("dim mismatch: expected {expected}, got {got}")]
DimMismatch {
expected: u32,
got: u32,
},
#[error("config error: {0}")]
Config(String),
#[error("environment variable {var} is not set")]
MissingApiKey {
var: String,
},
}