Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
1use thiserror::Error; 2 3#[derive(Debug, Error)] 4pub enum ConsumerError { 5 #[error(transparent)] 6 JetstreamConnectionError(#[from] jetstream::error::ConnectionError), 7 #[error(transparent)] 8 JetstreamConfigValidationError(#[from] jetstream::error::ConfigValidationError), 9 #[error("jetstream ended")] 10 JetstreamEnded, 11 #[error("delay queue output dropped")] 12 DelayQueueOutputDropped, 13} 14 15#[derive(Debug, Error)] 16pub enum ServerError { 17 #[error("server build error: {0}")] 18 AcmeBuildError(std::io::Error), 19 #[error("server exited: {0}")] 20 ServerExited(std::io::Error), 21} 22 23#[derive(Debug, Error)] 24pub enum IdentityError { 25 #[error("whatever: {0}")] 26 WhateverError(String), 27 #[error("bad DID: {0}")] 28 BadDid(&'static str), 29 #[error("identity types got mixed up: {0}")] 30 IdentityValTypeMixup(String), 31 #[error("foyer error: {0}")] 32 FoyerError(#[from] foyer::Error), 33 34 #[error("failed to resolve: {0}")] 35 ResolutionFailed(#[from] atrium_identity::Error), 36 // #[error("identity resolved but no handle found for user")] 37 // NoHandle, 38 #[error("found handle {0:?} but it appears invalid: {1}")] 39 InvalidHandle(String, &'static str), 40 41 #[error("could not convert atrium did doc to partial mini doc: {0}")] 42 BadDidDoc(String), 43 44 #[error("wrong key for clearing refresh queue: {0}")] 45 RefreshQueueKeyError(&'static str), 46} 47 48#[derive(Debug, Error)] 49pub enum MainTaskError { 50 #[error(transparent)] 51 ConsumerTaskError(#[from] ConsumerError), 52 #[error(transparent)] 53 ServerTaskError(#[from] ServerError), 54 #[error(transparent)] 55 IdentityTaskError(#[from] IdentityError), 56} 57 58#[derive(Debug, Error)] 59pub enum RecordError { 60 #[error("identity error: {0}")] 61 IdentityError(#[from] IdentityError), 62 #[error("repo could not be validated as either a DID or an atproto handle")] 63 BadRepo, 64 #[error("could not get record: {0}")] 65 NotFound(&'static str), 66 #[error("could nto parse pds url: {0}")] 67 UrlParseError(#[from] url::ParseError), 68 #[error("reqwest send failed: {0}")] 69 SendError(reqwest::Error), 70 #[error("reqwest raised for status: {0}")] 71 StatusError(reqwest::Error), 72 #[error("reqwest failed to parse json: {0}")] 73 ParseJsonError(reqwest::Error), 74 #[error("upstream getRecord did not include a CID")] 75 MissingUpstreamCid, 76 #[error("upstream CID was not valid: {0}")] 77 BadUpstreamCid(String), 78}