radicle_protocol/worker/fetch/
error.rs1use std::io;
2
3use thiserror::Error;
4
5use radicle::{cob, git, identity, storage};
6use radicle_fetch as fetch;
7
8#[derive(Debug, Error)]
9pub enum Fetch {
10 #[error(transparent)]
11 Run(#[from] fetch::Error),
12 #[error(transparent)]
13 Git(#[from] git::raw::Error),
14 #[error(transparent)]
15 Storage(#[from] storage::Error),
16 #[error(transparent)]
17 StorageCopy(#[from] io::Error),
18 #[error(transparent)]
19 Repository(#[from] radicle::storage::RepositoryError),
20 #[error(transparent)]
21 RefsDb(#[from] radicle::node::refs::Error),
22 #[error("validation of the storage repository failed: the delegates {delegates:?} failed to validate to meet a threshold of {threshold}")]
23 Validation {
24 threshold: usize,
25 delegates: Vec<String>,
26 },
27 #[error(transparent)]
28 Cache(#[from] Cache),
29}
30
31#[derive(Debug, Error)]
32pub enum Cache {
33 #[error(transparent)]
34 Parse(#[from] cob::ParseIdentifierError),
35 #[error(transparent)]
36 Repository(#[from] storage::RepositoryError),
37 #[error("failed to remove {type_name} '{id}' from cache: {err}")]
38 Remove {
39 id: cob::ObjectId,
40 type_name: cob::TypeName,
41 #[source]
42 err: Box<dyn std::error::Error + Send + Sync + 'static>,
43 },
44 #[error(transparent)]
45 Store(#[from] cob::store::Error),
46 #[error("failed to update {type_name} '{id}' in cache: {err}")]
47 Update {
48 id: cob::ObjectId,
49 type_name: cob::TypeName,
50 #[source]
51 err: Box<dyn std::error::Error + Send + Sync + 'static>,
52 },
53}
54
55#[derive(Debug, Error)]
56pub enum Handle {
57 #[error(transparent)]
58 Doc(#[from] identity::DocError),
59 #[error(transparent)]
60 Io(#[from] io::Error),
61 #[error(transparent)]
62 Init(#[from] fetch::handle::error::Init),
63 #[error(transparent)]
64 Storage(#[from] storage::Error),
65 #[error(transparent)]
66 Repository(#[from] radicle::storage::RepositoryError),
67}
68
69#[derive(Debug, Error)]
70pub enum Canonical {
71 #[error(transparent)]
72 Identity(#[from] radicle::storage::RepositoryError),
73 #[error(transparent)]
74 CanonicalRefs(#[from] radicle::identity::doc::CanonicalRefsError),
75}