KeiSeiKit-1.0/_primitives/_rust/kei-git-forgejo/src/error.rs
Parfii-bot 0be354a920 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

57 lines
1.5 KiB
Rust

// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 <author org>
//!
//! Error types for `kei-git-forgejo`. Maps cleanly into
//! `kei_runtime_core::Error` so the backend can fulfill `GitBackend`.
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("DNA: {0}")]
Dna(#[from] kei_runtime_core::DnaError),
#[error("config: {0}")]
Config(String),
#[error("auth: {0}")]
Auth(String),
#[error("network: {0}")]
Network(String),
#[error("not found: {0}")]
NotFound(String),
#[error("provider: {0}")]
Provider(String),
#[error("io: {0}")]
Io(#[from] std::io::Error),
#[error("serde: {0}")]
Serde(#[from] serde_json::Error),
}
pub type Result<T> = std::result::Result<T, Error>;
impl From<reqwest::Error> for Error {
fn from(e: reqwest::Error) -> Self {
Error::Network(e.to_string())
}
}
impl From<Error> for kei_runtime_core::Error {
fn from(e: Error) -> Self {
match e {
Error::Dna(e) => kei_runtime_core::Error::Dna(e),
Error::Config(s) => kei_runtime_core::Error::Config(s),
Error::Auth(s) => kei_runtime_core::Error::Auth(s),
Error::Network(s) => kei_runtime_core::Error::Network(s),
Error::NotFound(s) => kei_runtime_core::Error::NotFound(s),
Error::Provider(s) => kei_runtime_core::Error::Provider(s),
Error::Io(e) => kei_runtime_core::Error::Io(e),
Error::Serde(e) => kei_runtime_core::Error::Serde(e),
}
}
}