lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

error.rs (1811B)


      1 #![forbid(unsafe_code)]
      2 
      3 use thiserror::Error;
      4 
      5 #[derive(Debug, Error)]
      6 pub enum RadrootsRelayTransportError {
      7     #[error("Relay URL parse failed for `{url}`: {reason}")]
      8     RelayUrlParse { url: String, reason: String },
      9 
     10     #[error("Relay URL `{url}` uses ws outside localhost relay policy")]
     11     WsRequiresLocalhostPolicy { url: String },
     12 
     13     #[error("Relay URL `{url}` has unsupported scheme `{scheme}`")]
     14     UnsupportedRelayScheme { url: String, scheme: String },
     15 
     16     #[error("Relay URL `{url}` must include a host")]
     17     EmptyRelayHost { url: String },
     18 
     19     #[error("Relay URL `{url}` must not include userinfo")]
     20     RelayUrlUserinfo { url: String },
     21 
     22     #[error("Relay URL `{url}` must not include query or fragment")]
     23     RelayUrlQueryOrFragment { url: String },
     24 
     25     #[error("Relay URL `{url}` targets forbidden destination: {reason}")]
     26     RelayUrlForbiddenDestination { url: String, reason: String },
     27 
     28     #[error("Relay URL `{url}` resolved to forbidden address `{address}`: {reason}")]
     29     RelayUrlResolvedForbiddenDestination {
     30         url: String,
     31         address: String,
     32         reason: String,
     33     },
     34 
     35     #[error("Relay target set must not be empty")]
     36     EmptyTargetSet,
     37 
     38     #[error("JSON error: {0}")]
     39     Json(#[from] serde_json::Error),
     40 
     41     #[error("Nostr event JSON error: {0}")]
     42     NostrEventJson(String),
     43 
     44     #[cfg(feature = "storage")]
     45     #[error("Event store error: {0}")]
     46     EventStore(#[from] radroots_event_store::RadrootsEventStoreError),
     47 
     48     #[cfg(feature = "storage")]
     49     #[error("Outbox error: {0}")]
     50     Outbox(#[from] radroots_outbox::RadrootsOutboxError),
     51 
     52     #[cfg(feature = "storage")]
     53     #[error("Outbox claim {0} does not contain a signed event")]
     54     MissingSignedOutboxEvent(i64),
     55 
     56     #[error("Relay transport error: {0}")]
     57     Transport(String),
     58 }