// Back - An extremely simple git bug visualization system. Inspired by TVL's // panettone. // // Copyright (C) 2024 Benedikt Peetz // Copyright (C) 2025 Benedikt Peetz // SPDX-License-Identifier: AGPL-3.0-or-later // // This file is part of Back. // // You should have received a copy of the License along with this program. // If not, see . use std::{io, net::SocketAddr, path::PathBuf}; use git_bug::{ entities::{identity::Identity, issue::Issue}, replica::{ self, entity::{ id::prefix::{self, IdPrefix}, snapshot::Snapshot, }, }, }; use thiserror::Error; pub(crate) type Result = std::result::Result; #[derive(Error, Debug)] pub enum Error { #[error("while trying to parse the config file ({file}): {error}")] ConfigParse { file: PathBuf, error: serde_json::Error, }, #[error("while trying to read the project.list file ({file}): {error}")] ProjectListRead { file: PathBuf, error: io::Error }, #[error("while trying to read the config file ({file}): {error}")] ConfigRead { file: PathBuf, error: io::Error }, #[error("Repository ('{path}') has no initialized git-bug data")] NotGitBug { path: PathBuf }, #[error("while trying to open the repository ({repository_path}): {error}")] RepoOpen { repository_path: PathBuf, error: Box, }, #[error("while trying to get an entity reference from a replica: {0}")] RepoGetReferences(#[from] replica::get::Error), #[error("while trying to read an issues's data from a replica: {0}")] RepoIssueRead(#[from] replica::entity::read::Error), #[error("while trying to read an identity's data from a replica: {0}")] RepoIdentityRead(#[from] replica::entity::read::Error), #[error("failed to find the repository at path: '{repository_path}'")] RepoFind { repository_path: PathBuf }, #[error("while iteration over the refs in a repository: {0}")] RepoRefsIter(#[from] gix::refs::packed::buffer::open::Error), #[error("while prefixing the refs with a path: {error}")] RepoRefsPrefixed { error: io::Error }, #[error("while trying to open tcp {addr} for listening: {err}.")] TcpBind { addr: SocketAddr, err: io::Error }, #[error("while trying to accept a tcp connection: {err}.")] TcpAccept { err: io::Error }, #[error("There is no 'issue' associated with the prefix '{prefix}': {err}")] IssuesPrefixMissing { prefix: Box, err: prefix::resolve::Error, }, #[error("The given prefix ('{prefix}') can not be parsed as prefix: {error}")] IssuesPrefixParse { prefix: String, error: prefix::decode::Error, }, #[error("Route '{0}' was unknown.")] NotFound(PathBuf), #[error("Query '{query}' was not valid: {err}")] InvalidQuery { err: git_bug::query::parse::parser::Error>, query: String, }, }