radicle_surf/
error.rs

1// This file is part of radicle-surf
2// <https://github.com/radicle-dev/radicle-surf>
3//
4// Copyright (C) 2019-2023 The Radicle Team <dev@radicle.xyz>
5//
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License version 3 or
8// later as published by the Free Software Foundation.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18//! Definition for a crate level error type, which wraps up module level
19//! error types transparently.
20
21use crate::{commit, diff, fs, glob, namespace, refs, repo};
22use thiserror::Error;
23
24/// The crate level error type that wraps up module level error types.
25#[derive(Debug, Error)]
26#[non_exhaustive]
27pub enum Error {
28    #[error(transparent)]
29    Branches(#[from] refs::error::Branch),
30    #[error(transparent)]
31    Categories(#[from] refs::error::Category),
32    #[error(transparent)]
33    Commit(#[from] commit::Error),
34    #[error(transparent)]
35    Diff(#[from] diff::git::error::Diff),
36    #[error(transparent)]
37    Directory(#[from] fs::error::Directory),
38    #[error(transparent)]
39    File(#[from] fs::error::File),
40    #[error(transparent)]
41    Git(#[from] git2::Error),
42    #[error(transparent)]
43    Glob(#[from] glob::Error),
44    #[error(transparent)]
45    Namespace(#[from] namespace::Error),
46    #[error(transparent)]
47    RefFormat(#[from] git_ext::ref_format::Error),
48    #[error(transparent)]
49    Revision(Box<dyn std::error::Error + Send + Sync + 'static>),
50    #[error(transparent)]
51    ToCommit(Box<dyn std::error::Error + Send + Sync + 'static>),
52    #[error(transparent)]
53    Tags(#[from] refs::error::Tag),
54    #[error(transparent)]
55    Repo(#[from] repo::error::Repo),
56}