1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use reqwest::Error as ReqError;
use thiserror::Error;

pub type Result<T> = std::result::Result<T, UrbitAPIError>;

#[derive(Error, Debug)]
pub enum UrbitAPIError {
    #[error("Failed logging in to the ship given the provided url and code.")]
    FailedToLogin,
    #[error("Failed to create a new channel.")]
    FailedToCreateNewChannel,
    #[error("Failed to create a new subscription.")]
    FailedToCreateNewSubscription,
    #[error("Failed to send a chat message to chat {0}.")]
    FailedToSendChatMessage(String),
    #[error("Failed to acquire graph from Graph Store for resource {0}.")]
    FailedToGetGraph(String),
    #[error("Failed to archive graph from Graph Store for resource {0}.")]
    FailedToArchiveGraph(String),
    #[error("Failed to add nodes to Graph Store for resource {0}.")]
    FailedToAddNodesToGraphStore(String),
    #[error("Failed to remove nodes from Graph Store for resource {0}.")]
    FailedToRemoveNodesFromGraphStore(String),
    #[error("Failed to remove graph from Graph Store for resource {0}.")]
    FailedToRemoveGraphFromGraphStore(String),
    #[error("Failed to build a Graph struct from supplied JsonValue.")]
    FailedToCreateGraphFromJSON,
    #[error("Failed to build a Node struct from supplied JsonValue.")]
    FailedToCreateGraphNodeFromJSON,
    #[error("Failed to insert a Node struct into a Graph because of the index.")]
    FailedToInsertGraphNode,
    #[error("{0}")]
    Other(String),
    #[error(transparent)]
    ReqwestError(#[from] ReqError),
}