use thiserror::Error;
#[derive(Debug, Error)]
pub enum GitHubError {
#[error("Octocrab error: {0}")]
Octocrab(#[from] octocrab::Error),
#[error("GitHub API error: {0}")]
Api(String),
#[error("Invalid input: {0}")]
InvalidInput(String),
#[error("Resource not found: {0}")]
NotFound(String),
#[error("Authentication required")]
AuthRequired,
#[error("Rate limit exceeded")]
RateLimitExceeded,
#[error("Client setup failed: {0}")]
ClientSetup(String),
#[error("{0}")]
Custom(String),
#[error("{0}")]
Other(String),
}
pub type GitHubResult<T> = Result<T, GitHubError>;
impl From<String> for GitHubError {
fn from(s: String) -> Self {
GitHubError::Api(s)
}
}
impl From<&str> for GitHubError {
fn from(s: &str) -> Self {
GitHubError::Api(s.to_string())
}
}