Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

661 B
Raw Blame
#[derive(thiserror::Error, Debug, serde::Serialize)]
#[serde(tag = "type")]
pub enum RateLimitError {
    #[error("too many requests")]
    TooManyRequests,
    #[error("an unknown error occurred")]
    Generic(GenericErrorResponse),
}

#[derive(serde::Serialize, Debug)]
pub struct GenericErrorResponse {
    pub message: String,
}

impl From<anyhow::Error> for GenericErrorResponse {
    fn from(err: anyhow::Error) -> Self {
        Self {
            message: err.to_string(),
        }
    }
}

impl From<anyhow::Error> for RateLimitError {
    fn from(err: anyhow::Error) -> Self {
        RateLimitError::Generic(GenericErrorResponse::from(err))
    }
}