1use std::io;
3
4use thiserror::Error;
5
6#[derive(Error, Debug)]
9pub enum ConfigValidationError {
10 #[error("too many wanted collections: {0} > 100")]
11 TooManyWantedCollections(usize),
12 #[error("too many wanted DIDs: {0} > 10,000")]
13 TooManyDids(usize),
14}
15
16#[derive(Error, Debug)]
21pub enum ConnectionError {
22 #[error("invalid endpoint: {0}")]
23 InvalidEndpoint(#[from] url::ParseError),
24 #[error("failed to connect to Jetstream instance: {0}")]
25 WebSocketFailure(#[from] tokio_tungstenite::tungstenite::Error),
26 #[error("the Jetstream config is invalid (this really should not happen here): {0}")]
27 InvalidConfig(#[from] ConfigValidationError),
28}
29
30#[derive(Error, Debug)]
34pub enum JetstreamEventError {
35 #[error("received websocket message that could not be deserialized as JSON: {0}")]
36 ReceivedMalformedJSON(#[from] serde_json::Error),
37 #[error("failed to load built-in zstd dictionary for decoding: {0}")]
38 CompressionDictionaryError(io::Error),
39 #[error("failed to decode zstd-compressed message: {0}")]
40 CompressionDecoderError(io::Error),
41 #[error("all receivers were dropped but the websocket connection failed to close cleanly")]
42 WebSocketCloseFailure,
43}