at main 56 lines 1.7 kB view raw
1use miette::Diagnostic; 2use thiserror::Error; 3 4#[derive(Debug, Error, Diagnostic)] 5pub enum AtProtoPreprocessError { 6 #[error("blob upload failed: {0}")] 7 #[diagnostic(code(atproto::preprocess::blob_upload))] 8 BlobUpload(String, #[source] Box<dyn std::error::Error + Send + Sync>), 9 10 #[error("failed to resolve handle {handle} to DID")] 11 #[diagnostic(code(atproto::preprocess::handle_resolution))] 12 HandleResolution { 13 handle: String, 14 #[source] 15 source: Box<dyn std::error::Error + Send + Sync>, 16 }, 17 18 #[error("entry not found in vault: {0}")] 19 #[diagnostic(code(atproto::preprocess::entry_not_found))] 20 EntryNotFound(String), 21 22 #[error("invalid image path: {0}")] 23 #[diagnostic(code(atproto::preprocess::invalid_image))] 24 InvalidImage(String), 25 26 #[error("io error: {0}")] 27 #[diagnostic(code(atproto::preprocess::io))] 28 Io(#[from] std::io::Error), 29 30 #[error("invalid AT URI: {0}")] 31 #[diagnostic(code(atproto::preprocess::invalid_uri))] 32 InvalidUri(String), 33 34 #[error("failed to fetch record: {0}")] 35 #[diagnostic(code(atproto::preprocess::fetch_failed))] 36 FetchFailed(String), 37 38 #[error("failed to parse record: {0}")] 39 #[diagnostic(code(atproto::preprocess::parse_failed))] 40 ParseFailed(String), 41} 42 43#[derive(Debug, Error, Diagnostic)] 44pub enum ClientRenderError { 45 #[error("failed to fetch embedded entry: {uri}")] 46 #[diagnostic(code(atproto::client::entry_fetch))] 47 EntryFetch { 48 uri: String, 49 #[source] 50 source: Box<dyn std::error::Error + Send + Sync>, 51 }, 52 53 #[error("blob not found in entry embeds: {name}")] 54 #[diagnostic(code(atproto::client::blob_not_found))] 55 BlobNotFound { name: String }, 56}